-Define - which image size?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

-Define - which image size?

Post by Albireo »

Hello!

Which dimensions should be set to "define" to optimize conversion?
for example: I have an .jpg image 1600x1200 (maybe larger), and want a new image on the web.
(I don't know the optimal image size on web :) )

Example of a "convert" Commando:

Code: Select all

convert -define jpeg:size=240x180 Image.jpg -resize 100x80 NewImage.gif
Is it optimal to give "-define" double size as the size of the new image?
Will it be a lower picture quality, by using "-define"? (instead of only using "-resize")

__________________________________________________________________________

Info:

On page: http://www.imagemagick.org/Usage/formats/#jpg_read
are the following example: (I don't know the size of image.jpg)

Code: Select all

convert -define jpeg:size=240x180 image.jpg -thumbnail 120x90 thumbs/image.gif
On the site:
http://www.imagemagick.org/script/comma ... hp?#define
can you read about the benefits of using "-define"

On this site:
http://www.imagemagick.org/Usage/formats/#jpg_read
I found the following: "This setting is a hint to the JPEG image library to read just enough of the input (JPEG) image file to create an image that is at least the given size (width × height) or larger."

//Jan
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: -Define - which image size?

Post by Bonzo »

The jpg "hint" speeds up the conversion size of the jpg and should be the same as the finished image size so I would use:

Code: Select all

convert -size 100x80 Image.jpg -resize 100x80 NewImage.gif
For a 2.8Mb image it resized nearly 3x faster : http://www.rubblewebs.co.uk/imagemagick/notes/speed.php

Looking at one of your links I see that:
Before IM v6.5.6-0 this coder setting was extracted from the "-size" setting. This caused problems when users used "-size" for image creation but then had JPEG reading produce unexpected results. As such this was changed to be a special coder setting instead.

On older versions you may need to reset the setting using "+size before reading JPEG images.
The difference between -resize ( just resize and leave all EXIF data ) -thumbnail ( resize and remove all EXIF data except colour profile ) -resize or -thumbnail and -strip ( remove all EXIF data and colour profile ).
Removing the EXIF data can reduce the file size quite a bit.
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: -Define - which image size?

Post by Albireo »

Thank you!
Bonzo wrote:The jpg "hint" speeds up the conversion size of the jpg and should be the same as the finished image size so I would use:......
But, in all example, "-define" has the double size against the final image.
(double size - applies it only when doing "thumbnails"? or...)

/Jan
Post Reply