Increasing Image Quality

Hi all,

I’m dealing with exporting excel chart/s via using vb.net. There is problem with when i exporting charts as a png format. When i open the chartImage.png the quality is very low like a blur, it’s hard to read.
Is there a way to increase the quality via using vb.net or activities(It cannot be 3rd partions)?

NOT : I’m not taking screenshot.

For now i cannot share the picture of charts. Because of security problem. :frowning:

Thank you.

1 Like

@Kuki_Force

Ensure that you are exporting the chart with the desired size and resolution. You can set the width and height of the image to a larger value to get a higher quality image. For example, use the Width and Height.

chartImage.Save("ChartImage.png", System.Drawing.Imaging.ImageFormat.Png)
chartImage.Dispose()

You can set the resolution (DPI) of the exported image. Higher resolution results in better quality. You can set it using the SetResolution method.

chartImage.SetResolution(300, 300) ' Set to 300 DPI
chartImage.Save("ChartImage.png", System.Drawing.Imaging.ImageFormat.Png)
chartImage.Dispose()

Depending on your needs, consider using other image formats that may provide better quality than PNG. Formats like JPEG, TIFF, or BMP may be suitable for certain use cases.

There are three ways to handle this

  1. Using vb itself where Specify a higher DPI (Dots Per Inch): DPI controls the image’s resolution. A higher DPI results in a higher quality image. You can set the DPI using code like this:

vb.netCopy code

chart.Export("chartImage.png", "PNG", resolution:=300)

In the code above, resolution:=300 sets the DPI to 300, which is considered high quality for images.

  1. Using TAKE SCREENSHOT activity from UiPath

  2. Using custom component to export chart from excel as a image
    UiPathGo - BalaReva Excel Activities - #28 by balupad14

Hope this helps

Cheers @Kuki_Force

Hi,

Do you use GetChart activity? If not, how about the following?

Regards,

Hi thanks for answer.

What is type of chartImage?

The type of the chartImage variable depends on how you obtain or create the image.
Bitmap or Image : System.Drawing.Bitmap or System.Drawing.Image

you can use System.Drawing.Bitmap