in reply to Re: imagemagick file size reduction
in thread imagemagick file size reduction

Hi,

Thanks for your reply. I have an 84kb image and just using Resize(width=>$x, height=>$y) reduced to around 62kb. using your geometry reduces further to 56kb. On further reading I have used $x = $image->Thumbnail (width=>160, height=>$r); and this has got it down to 23kb! (But a partial reason for the reduction is I have reduced the resulting file dimension from width 180 to 160. Still it's a pleasing result!)

I am using rented server which doesn't have telnet so I need to write the command line stuff into an actual script to action it, and I don't know how to do that. I'd be interested to know if it further reduces file size.

Replies are listed 'Best First'.
Re^3: imagemagick file size reduction
by zentara (Cardinal) on Mar 22, 2008 at 18:09 UTC
    If you are desparate to get size down, you can add a quality option, it will start to make things grainy, if below .75.
    $image->Write($outfile.jpg, compression => 'JPEG', quality=>.5); # I think it goes 0 to 1 for quality, ImageMagick has minimal # perl docs, so groups.google.com search for examples

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re^3: imagemagick file size reduction
by CountZero (Bishop) on Mar 22, 2008 at 22:36 UTC
    if you just wish to execute the command line, use system:

    system 'convert -strip -scale 3%x3% -quality 70 bigimage.jpg thumbnail.jpg'

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James