[thelist] ImageMagick and convert

Bob Meetin ontheroad at frii.com
Tue Oct 3 12:20:52 CDT 2006


Juha & et,

Resaving - yes I was seeing that the results drop off with subsequent 
re-saves and will attempt to avoid that.  I ought to be able to change 
the context of the loop such that if the first resave doesn't net the 
required results, then it adjusts the compression figure (say 80 to 70) 
and reprocesses the original image, not the already processed.  The user 
would need to visually approve/reject the lowered quality image...

The intent is to provide an interface for non-tech type users that 
transparently (for them) uploads the file and makes it more palatable to 
potential viewers.  Yes - I use a maxsize limit with an apology (if 
really extreme), but of course this somewhat assumes that the viewer is 
knowledgeable enough to understand the problem with his/her images.  And 
of course I can include some basic procedures for one or two common 
applications to fix the files before uploading, but I'm trying to get 
away from complicating their life.  Somewhere there is balance.

Can you or anyone suggest a better approach to solving the problem of 
site speed and over-sized images?

-Bob

Juha Suni wrote:
> Bob Meetin wrote:
>   
>> The command seems to work, but I don't understand the results.   At
>> best I would expect quality of 100(%) to get me an image about the
>> same size as the original, but no, it is approximately double,
>> turning a 182k image into 406k.  Adjusting to 50(%) results in 94k
>> and 30(%) results in 69k with 10% to 35k and a worthless file.
>>
>> What am I missing, why does 100% more than double the file size?
>>     
>
> Without delving too deep into the issue, or the way ImageMagick handles the 
> files:
>
> I assume you are talking about jpeg-images. Jpeg is a lossy algorithm, and 
> therefore re-saving over and over again is already a pretty bad idea. Every 
> save, no matter the quality setting, will decrease the actual quality of the 
> image, while not necessarily decreasing file size.
>
> Example image, a semi-large photograph, for example 1280x1024 pixels. When 
> you save it as jpeg with, for example, 80% quality setting, you might end up 
> with a file of 100KB. The quality is pretty good, although zooming closer 
> would reveal the jpeg compression artifacts. Now reopen that jpeg in the 
> editor of your choice. For the image-editor, for most purposes, this is just 
> another 1280x1024 file, which is assumed to be full quality just the way it 
> is, along with its jpeg artifacts. Save the image again as jpeg with the 
> quality set to 100%, and it is pretty much as saving any other 1280x1024 
> pixel image with a 100% quality - the file size will propably be over 200KB. 
> With the second operation you have just more than doubled the file size 
> without improving quality at all. Had you used 90%, you would have actually 
> degraded the quality while still making the filesize larger.
>
> In general opening and resaving jpegs is a very very bad idea quality-wise. 
> You should always open the original, and with a single operation save it 
> with the quality you wish to use.
>
> Some photo editors propably have ways to fight this problem to a degree, and 
> most likely there is some ImageMagick-weirdness happening here also. As a 
> rule of thumb, however, don't do jpeg resaving, not many times anyway.
>
>   





More information about the thelist mailing list