[thelist] ImageMagick and convert

Bob Meetin ontheroad at frii.com
Mon Oct 2 16:39:06 CDT 2006

I use the convert option ImageMagick (on a linux server) to 
increase/decrease the compression of uploaded files.  For instance if a 
client uploads a 500KB file, I use convert to make it a lighter file.  
I'm coupling that with  a php while loop to keep checking the file size, 
and once it reaches, say 50K, it will break out. 

The code is: 

$make_file = system("convert $file -density 72x72 -quality 100  
'$newfile'", $retval);

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?


More information about the thelist mailing list