cancel
Showing results for 
Search instead for 
Did you mean: 

How to save image data type (Data item) to desktop folder png format?

ÖzençGezgin
Level 4
I have an image data type (Data item) . I want to save this file to desktop folder. How can it be?
13 REPLIES 13

david.l.morris
Level 15
I'll probably facepalm after I ask this question. How did you get the image into the image data item to begin with (other than importing through BP's UI? If you're just trying to pull an image into Blue Prism and hold it for a while and then save it somewhere later on, you can use a binary data item instead. Use a Calculation stage with the function LoadBinaryFile([C:\Test\image.png]) to get it into a binary data item. Then use the File Management VBO's action 'Write Binary Data' to write it to another location. Of course, I'm assuming that (1) simply moving the file isn't good enough and (2) you don't need to use the image while in transit.

Dave Morris, 3Ci at Southern Company

david.l.morris
Level 15
Oops... (I really wish we could edit posts) LoadBinaryFile(""C:\Test\image.png"")

Dave Morris, 3Ci at Southern Company

HuYue
Level 2
I have the same problem.Meybe you did not understand us.For example.I have a Data Item with type 'image' named 'imagedata'.This image is not imported but from dynamic by Region Mode(Surface Automation).Then how to save this variable to local folder. There is no function' LoadBinaryFile' in a calculation stage.Can you help me? Thanks.

david.l.morris
Level 15
Hi huyue, There is a function in a calc stage called 'LoadBinaryFile'. Check the File group of functions. But that function doesn't apply to what you need. If you've got an image in a data item that you want to save, I don't know of an existing function or action for that. However, it seems as though writing code for this is pretty easy. I don't know what format you need, so it may be slightly different for you. Below works for me (C#): varImage.Save(saveLocation,ImageFormat.Png); That's with 'varImage' being an input variable to your code stage and you pass in your image data item. And 'saveLocation' is something like 'C:\Test\fileName.png'. Dave    

Dave Morris, 3Ci at Southern Company

david.l.morris
Level 15
Also, I had to add the Namespace Import of 'System.Drawing.Imaging' so that the Compiler would be happy.

Dave Morris, 3Ci at Southern Company

Thanks @Dave Morris-- This works .. I am trying to save different images from a PDFs as separate pngs​ and this helped

------------------------------
Harshit Rawat
Senior RPA Consultant
------------------------------

Awesome! Glad it helped!

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Hi Dave,

Just for another way this can happen. It's possible to read an image when you've spied it using surface automation, just grab a read stage and select "Read Image".

I had to use this a lot in v5 for image matching, but you never know when something like this may come in use!

I would imagine to save it down, you'd need to "write" it into an image editing application as there's no internal functionality to save an image. Would be interested to hear if you can think of a way to do this though.

Regards

------------------------------
Ben Lyons
Product Consultant
Blue Prism
UK
------------------------------
Ben Lyons
Principal Product Specialist - Decipher
SS&C Blue Prism
UK based

Yeah it works to just save by using the File Management VBO's action 'Write Binary Data' and include the image extension such as .png or whatever. I said that stuff over two years ago so I don't even remember typing that stuff. Haha! But yeah image files typically are binary data (not sure if all image types are or not) and they can be just written to the disk with the right file extension and then it'll display if you were to open it.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company