Screenshot file size

My robot takes a screenshot and saves them to a word file. The problem is, each screenshot is about 5MB, so after 60 screenshots it reaches 300MB. This same file used to be a lot smaller when I used the snipping tool, but with similar quality. Is there a way to manage the filesize of take screenshot activity?

1 Like

Hi
Take Screenshot works similar to Print Screen
Kindly try once with Print screen manually and let’s check what is the file size
Cheers @tiubenedict

1 Like

Hi @Palaniyappan! Printscreen images come out roughly 200KB vs 5MB from Take Screenshot activity. I have a dual monitor setup (print screen takes/shoots both screen), so I use Take Screenshot activity with a specific window instead since I only need a webpage.

Edit: a little more of how the process goes~
Take screenshot activity - stores it into an image variable
Invoke Method activity - System.Windows.Forms.Clipboard, MethodName: SetImage
Ctrl+V into Word file

1 Like

Kindly correct me if i m wrong
If we want to save that image to a word
Once after taking screenshot we can use SABE IMAGE activity and pass that image variable as Inout and mention the filepath with file extension as .png

Then we can directly use word package
For that go to Deisgn tab-> Manage Packages -> under official tab search as UiPath.Word and install that package

Now in studio use word application scope and pass the file path of word document and use INSERT PICTURE activity and mention the filepath of image as input

Cheers @tiubenedict

1 Like

Yes that’s also possible, but I didn’t want to save 60 plus images since I only want to mimic copy paste. If I do this method, I will have to add another piece of workflow that deletes that folder, which (in my opinion) just adds complexity which should be avoidable - or I delete this folder myself. I find it risky to have a workflow that deletes things, especially when the robot is passed/published to the users.

1 Like

That’s not a issue at all buddy
We ca either use MOVE or DELETE FILE activity

Like we can use a assign like
Arr_files = Directory.GetFiles(“yourfolderpath”)
Where arr_files is a variable of type array of string

—now pass this array variable as input to FOR EACH loop and change age the type argument of type string
—inside the loop use DELETE activity and mention the input as item.ToString
Or instead we
Can use MOVE FILE activity and mention input path as item.ToString and destination as Folder path where you want to move this file

This will not add any hindrance to your process and it’s actually a good process to delete or move once if it is processed

Cheers @tiubenedict

1 Like

Thank you very much for the guidance @Palaniyappan. I’ll try this out and see if I get smaller filesizes :smiley: I’ll report back!

hi, how do you make the filename of the saved image start from 1 and just increments as the robot saves another image?
thank you! apologies for the diff topic.

Hi, depending on how you loop, you can just insert a counter variable that increments each time you start the activity that captures an image. Then insert that counter variable in your file name field in the save image activity. Does that help? @josephivann

1 Like

how do I increment in a loop?

Say you have a variable, ctr. You just use an assign activity, and write ctr = ctr + 1 right before your save image activity.

1 Like

is it like this? inside the for loop

  1. create an int variable ctr with a value of 0.
  2. assign ctr = ctr+1
  3. save image
1 Like

Hi @tiubenedict

If you are still searching for the solution please try the attached nuget.
and apply scale between 0-100

ImageCompression.Activities.1.0.0.nupkg (5.1 KB)

Thanks
Anoop

1 Like