How do I store an image into an image data item instead of manually importing it in Blue Prism? I need to automate it.

#1
I am Using Google Vision API to extract some data from some images.

But the problem is that I need to manually import and assign the image file each time in the image data item for each time.

How to get the image data item get automatically assigned by image path or something like that.
Please help.
Thanks in advance
. View attachment Screenshot_1.jpg
 

VJR

Well-Known Member
Staff member
#5
Hi blueorange92,

If I understood your posts correctly are you looking to store an Image file from a path into an Image data item?
If so you could achieve this using a Code stage. (Prior to this see if it can be achieved using any of the existing available actions of the VBOs)

Object Diagram:

View attachment 1530594569371.png

Input parameters Code stage:

View attachment 1530594730592.png

Output parameters Code Stage:

View attachment 1530594763065.png

The actual Code stage:

Code:
Dim OutputImg As Image

Try

varImageDataItem = OutputImg.FromFile(varFullImagePath)


Success = True

Catch e As Exception
    Success = False
    Message = e.Message
Finally  
    OutputImg= nothing
End Try
Image Data Item populated after running the process:

View attachment 1530595114422.png
 
#6
Hi blueorange92,

If I understood your posts correctly are you looking to store an Image file from a path into an Image data item?
If so you could achieve this using a Code stage. (Prior to this see if it can be achieved using any of the existing available actions of the VBOs)

Object Diagram:

View attachment 1264

Input parameters Code stage:

View attachment 1265

Output parameters Code Stage:

View attachment 1266

The actual Code stage:

Code:
Dim OutputImg As Image

Try

varImageDataItem = OutputImg.FromFile(varFullImagePath)


Success = True

Catch e As Exception
    Success = False
    Message = e.Message
Finally 
    OutputImg= nothing
End Try
Image Data Item populated after running the process:

View attachment 1267


Thank you Solved this solved.:)
 
#8
Hi blueorange92,

If I understood your posts correctly are you looking to store an Image file from a path into an Image data item?
If so you could achieve this using a Code stage. (Prior to this see if it can be achieved using any of the existing available actions of the VBOs)

Object Diagram:

View attachment 1264

Input parameters Code stage:

View attachment 1265

Output parameters Code Stage:

View attachment 1266

The actual Code stage:

Code:
Dim OutputImg As Image

Try

varImageDataItem = OutputImg.FromFile(varFullImagePath)


Success = True

Catch e As Exception
    Success = False
    Message = e.Message
Finally 
    OutputImg= nothing
End Try
Image Data Item populated after running the process:

View attachment 1267
Hello,

Your code is working fine. Thanks.

I got an error on the console while using it:

Description: Compiler warning at line 5: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

line 5 : varImageDataItem = OutputImg.FromFile(varFullImagePath)

Can you help me?

Thanks,

Daniel.
 
#9
Hi Daniel,

Try with this code Stage
Code:
Dim OutputImg As Object

Try


OutputImg = Image.FromFile(varFullImagePath)

varImageDataItem = OutputImg


Success = True

Catch e As Exception
    Success = False
    Message = e.Message
Finally
    OutputImg= nothing
End Try
 
Top