Forums

Welcome Guest Search | Active Topics | Members

File Size Reduced Options
undead80
Posted: Sunday, February 17, 2008 9:09:35 AM
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.
Alex Kon
Posted: Sunday, February 17, 2008 10:30:17 PM
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.
undead80
Posted: Monday, February 18, 2008 2:21:16 AM
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?

Alex Kon
Posted: Monday, February 18, 2008 11:25:56 PM
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.
undead80
Posted: Tuesday, February 19, 2008 9:05:28 AM
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.
Alex Kon
Posted: Wednesday, February 20, 2008 4:24:36 AM
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.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.