Author Topic: [SOLVED] Downsize *and* compress images upon upload via ImageMagick?  (Read 3925 times)

0 Members and 1 Guest are viewing this topic.

Offline Bytes_U

  • album.pl Donor
  • album.pl Contributor
  • ***
  • Posts: 75
  • Karma: +0/-0
  • Oh no... not again?
Is there a way to specify the quality (or compression) setting on full sized images being uploaded by visitors? Currently ImageMagick takes their full blown 3072 x 2304 image files and downsizes it to 640x480 upon upload (as per my settings). What ImageMagick no longer seems to do, is also re-adjust the quality setting (compression) of the image. In the past I commonly got 640x480 re-sized images around 120kb or less but now they all are above 220kb. Is this something that changed on my host provider's ImageMagick binaries or is there a album.pl quality setting that can be hacked like the "thumb_quality" setting?
« Last Edit: June 02, 2007, 13:45:27 by Bytes_U »

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: Downsize *and* compress images upon upload via ImageMagick?
« Reply #1 on: May 10, 2007, 19:58:26 »
see the instructions on using the "postupload" paramaters in your configuration file. You can pass pretty much any ImageMagick option. Those are listed at http://www.imagemagick.org/script/command-line-options.php
Experiment. Have fun!

Offline Bytes_U

  • album.pl Donor
  • album.pl Contributor
  • ***
  • Posts: 75
  • Karma: +0/-0
  • Oh no... not again?
Re: Downsize *and* compress images upon upload via ImageMagick?
« Reply #2 on: May 19, 2007, 12:22:00 »
Thanks for the tip Frister. My goal is to compress upload images at quality 82 (album.pl currently seems to resize clients full camera images to 640x480 but quality 100) so I used the following postupload command variations without success. Could someone please help with my postupload command syntax for imagemagick.

Code: [Select]
postupload=convert -quality 82 ####OBJECT####
postupload=quality 82 ####OBJECT####
postupload=/usr/local/bin/convert -quality 82 ####OBJECT####
postupload=compress -quality 82 ####OBJECT####

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: Downsize *and* compress images upon upload via ImageMagick?
« Reply #3 on: May 31, 2007, 22:08:45 »
Not sure what's up with your server.
Code: [Select]
postupload=convert -quality 80 ####OBJECT#### works just fine on my box. What has a bigger effect on file size is the resizing operation itself.
My original was 1158KB 1536x1024 pixels. End result is 133KB 800x533 pixels. Resizing alone, without quality change gives me 139KB. Without the resizing, using only the postupload quality setting, file size is still 367KB.

Run the upload page with full debugging turned on to see if your postupload command is throwing any errors.

You can laso try leaving postupload blank and just putting the quality setting in the pic_resize option:
Code: [Select]
pic_resize=800x800 -quality 80This worked equally well for me.

Offline Bytes_U

  • album.pl Donor
  • album.pl Contributor
  • ***
  • Posts: 75
  • Karma: +0/-0
  • Oh no... not again?
Re: Downsize *and* compress images upon upload via ImageMagick?
« Reply #4 on: June 02, 2007, 13:35:44 »
...You can also try leaving postupload blank and just putting the quality setting in the pic_resize option:
Code: [Select]
pic_resize=800x800 -quality 80This worked equally well for me.
SUCCESS! Thanks frister... the switch (-quality xx) added to "pic_resize=640" worked on my server returning a resized and compressed image where my postupload settings did not.