Page 1 of 2

Best command for resizing large pics for highest quality.

Posted: 2010-03-18T10:08:30-07:00
by davidb2002
I work on a photography website and need to resize user's photos down to photos that are no bigger than 600x600. The uploads are jpeg files and the current command I am using gives alot of artifacts. I have upped quality to 100 and although less artifiacts, still not as acurate as photoshop. Any suggestions on the best command to downsize high res photos (we are talking photos from Digital SLRs) for the most minimal amount of artifacts, distoration in colour, etc.

My Current command:

Code: Select all

/usr/bin/convert  -strip -geometry 600x600 -quality 85 '/temp/file.jpg' '/new/file.jpg'
Cheers for any help!

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-18T10:13:38-07:00
by fmw42
I am surprised that even works. -geometry is a setting and not an operator/option

try

convert image.jpg -strip -resize 600x600 -quality 85 result.jpg


you may want to look into profiles also (but I am no expert on that)

see http://www.imagemagick.org/Usage/formats/#profiles

see also http://www.imagemagick.org/Usage/basics/#why regarding order of items in command line

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-19T07:24:45-07:00
by davidb2002
I have tried with resize and the new order and I don't see any difference in quality. So I upped -quality to 100 and this does provide better quality, but the image appears darker then if I was to do it in photoshop.

I am basically trying to replicate what photoshop does when you resize a large image. Once I have done that, I need to concentrate on decreasing the filesize of the image.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-19T11:58:01-07:00
by fmw42
I am told that photoshop may include an unsharp masking effect when resizing.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-20T06:05:33-07:00
by kankwayot
You speak about downsized images that are darkened .. methinks that you will possibly find this link about gamma-aware resizing to be of interest :

http://www.4p8.com/eric.brasseur/gamma.html#ImageMagick

An ImageMagick command chiseled to satisfyingly downsize JPEG images is even provided !

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-20T06:18:19-07:00
by magick
The Eric Basseur article has a mistake. The option is -resize, not -scale. Only -resize accepts the -filter option.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-20T13:03:37-07:00
by snibgo
In my experience, IM doesn't darken images or introduce "lots of artifacts" when shrinking photos. (But very low JPEG quality values will introduce artifacts, of course.)

Can you link to examples, with the command(s) that created them? And what version of IM do you use?

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T04:22:20-07:00
by davidb2002
Have tried that other command and thats really bad. It' lightens all the whites. The closest thing I have is my original command with quality 100. but colours (mainly reds) do appear slightly darker, especially around the edges.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T04:30:26-07:00
by davidb2002
Here are some examples.

Photoshop resize and save @ 100%

Image

IM: origina.jpg -strip -resize 600x600 -quality 100 new.jpg

Image

Notice the differences in the Reds (particuarly, the red toy truck). ImageMagick 6.2.8 04/17/08 Q16

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T08:44:48-07:00
by snibgo
When I place those images side-by-side, I can't detect any difference. (They look different when placed vertically on LCD monitors, because LCD monitors do that.)

When I examine them with Gimp color picker, sample average, radius 20, on the red truck at location 261,82:

image 52194_1269256674.jpg reports rgb(129,59,53)
image original_testshot.jpg reports rgb(130,59,54)

My eyes can't detect a 1/255 difference in two of three channels.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T09:04:56-07:00
by fmw42
using

compare -metric rmse testshot_im.jpg testshot_ps.jpg null:
792.999 (0.0121004)


This shows a 1.2% rmse difference. And as I mentioned before, I have been told that PS adds unsharp masking to its process of resizing to sharpen slightly.

Plus IM uses a different and probably better resize filter (Lanczos) and PS uses cubic convolution.

see

http://www.imagemagick.org/Usage/resize/#filter
http://www.imagemagick.org/Usage/resize/#photoshop

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T09:31:40-07:00
by snibgo
At 800% magnification, I can't see any unsharp masking in that PS image, compared to the IM version.

On a flicker comparison, I can't see any difference -- there is no flicker.

Incidentally, it may be worth upgrading IM that is a couple of years old.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T09:37:54-07:00
by fmw42
Anthony mentioned the unsharp masking to me, but I have no other verification. The main issue, I think, would be different resizing filters used by IM and Photoshop. But you can choose matching filters (presumably matching by name), if you want to try that. See the IM page referenced and the -filter option set before -resize.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-22T09:51:30-07:00
by fmw42
I can alternate (flicker) the two images in Mac Preview and the PS image is definitely darker. BUT flickering them with my flicker script in the IM display in X11, shows very little difference.

Might it be a profile difference?

Identify -verbose on the PS image shows profiles

Profiles:
Profile-8bim: 6592 bytes
Profile-exif: 6152 bytes
Profile-icc: 3144 bytes
IEC 61966-2.1 Default RGB colour space - sRGB
Profile-xmp: 5163 bytes


The IM image has no profiles.

Try stripping the profiles from the PS image or adding the profiles to the IM image.

Re: Best command for resizing large pics for highest quality

Posted: 2010-03-31T09:08:53-07:00
by davidb2002
The trouble is that I need to not only replicate as close as I can to photoshop, but also keep filesize as small as possible too. So therefore we have added -strip for that reason. However, it's still much much bigger than a photoshoped version.

Any recommendatiosn on reducing filesize without reducing image quality too much?