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

blueorange92

New Member
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
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
 

blueorange92

New Member
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.:)
 
  • Like
Reactions: VJR

Malligai

Member
By using entire filepath of that particular image, by using calc stage try to store in image data type.

Sukesh,

While doing the same, am getting conversion error. am getting the details in collection. but cant get the image. while moved into calc, its not allowing to convert.
 

Daniel B F

New Member
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.
 

Isaac Barboza

New Member
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
 

carolinegarrad

New Member
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
Hi, thank you for providing the above code. I'm using this in one of my processes but it seems to be rotating images at random. Is there anything that can be added to the code to prevent this from happening?

Thanks you
 
Top