|
|
Rank: Member Groups: Member
Joined: 1/8/2008 Posts: 28 Points: 84
|
Hi, I am having a code as below Code: 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.
|
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 1/31/2005 Posts: 386 Points: 403
|
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.
Best wishes, Alex.
|
|
Rank: Member Groups: Member
Joined: 1/8/2008 Posts: 28 Points: 84
|
Hi,
May I have the sample code to change the bitmap save/open compression?
|
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 1/31/2005 Posts: 386 Points: 403
|
Hello, You can find detailed description and some code samples in this article: Understanding of JPEG Encoding Parameters.
Best wishes, Alex.
|
|
Rank: Member Groups: Member
Joined: 1/8/2008 Posts: 28 Points: 84
|
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.
|
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 1/31/2005 Posts: 386 Points: 403
|
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).
Best wishes, Alex.
|
|
|
Guest |