This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

File Size Reduced

Hi,

I am having a code as below


    Dim image as new Aurigma.GraphicMill.Bitmap(WorkingBitmap)

    image.Save(WorkingBitmap)


What I found is, after the "open and save" code, it reduce my file size a lot. May I know is that due to some setting that i left out ? or there is actually a better compression? or the quality has been reduced? (I check the dpi, width and height, and they seems the same value as the original file)

Please advice.
Hello,

It depends on the file format you have used. Theoretically, it is possible to get smaller size (and quality) of the image with such code.

For example, if you load image and save it to JPEG with default compression value (75 of 100) - you will lose some quality and will get smaller file. You can place this code in a loop for a 5-20 iterations to get clearly visible degradation of the image.

Hi,

May I have the sample code to change the bitmap save/open compression?

Thanks for the reference.

Just wondering is there anyway to keep the file size "almost" the same? or with least quality drop?

bitmap.Save(_item.Pidl.Path, New Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, False, False))

I was trying to use this code, but seems like for each iteration, it will keep increasing the file size. Please advice.
Hello,

As I understand, there is no such way with JPEG (or any other lossy format). You may switch to some non-lossy format (e.g. PNG), or minimize/avoid re-saving operations if it is possible in your task (e.g. via lossless JPEG transforms).