Jump to content

load image from my C drive


Maria Romero

Recommended Posts

Hello there I am trying to load image from my C: drive in a data table. The only example I found is one video that shows how to do perform this with a data that has flags creating a bynary column.https://www.youtube.com/watchv=c41ScJs1b_k

I downloaded the example that comes with an Script. Please bared in mind that I know how to steal a script and sometimes use it succesfully but I am not a programer.

The Script stops at line 8 with the following error.

File "", line 8, in

ValueError: Unsupported type conversion

Does anybody can help to understand how to overcome this problem I have added a column in my table as 'string', as 'text', as 'number' called Flags but still giving me this message.

Or any other alternative for loading images in a data table from your C: drive

 

----------------

 

from Spotfire.Dxp.Data import *

from System.IO import *

from System.Drawing import *

from System.Drawing.Imaging import *

table=Document.Data.Tables["Core Sampling2"]

column=table.Columns["Flags"]

cursor=DataValueCursor.Create[binaryLargeObject](column);

for row in table.GetRows(cursor):

value=cursor.CurrentValue

stream=value.GetByteStream()

img=Image.FromStream(stream)

filePath="C:ImagesmyImage" + str(row.Index) + ".Jpeg"

img.Save(filePath, ImageFormat.Jpeg)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...