Convert to fixed imagesize on Linux-Server

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
Helmut M.
Posts: 2
Joined: 2012-11-23T09:23:11-07:00
Authentication code: 6789

Convert to fixed imagesize on Linux-Server

Post by Helmut M. »

Hello,
I have more than 5000 high resolution (300dpi) jpg images with different size, different cmyk profiles, clipping-path and white background. For our webshop I want to convert all images to the same size of 800x600 with white background and low resolution.

Test on windows 7 with IM 6.7.9-0 Q-16 :

Code: Select all

convert image.jpg -profile iso.icc +profile iso.icc -profile eci.icc -thumbnail 800x600 -support 1.0 -filter cubic -unsharp 1x2 -density 72x72 -quality 75 -background white -gravity center -extent 800x600 image.jpg
This works an a lot of files looks well, but the datavolume of some files is more than 100 kb.

It works not on our Linux-Server (I dont know the image magick version, but I will ask our Admin), because we get images with black areas on different sides.

Please help me. Thank you in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert to fixed imagesize on Linux-Server

Post by fmw42 »

I don't really know. Try moving -quality 75 to the end just before the output. I am not sure why you get black on some of them. Perhaps you could post a link to one that gives black so we can see it and check its verbose info (or post that if you cannot post the image).

Your filter arguments should come before -thumbnail.

-filter cubic -thumbnail 800x600

Also -unsharp 1x2 is not a very good set of parameters. Typically that will cut off the gaussian before it gets close to zero. Typically just leave the radius to 0 and set the sigma. IM will then determine the optimal radius for that sigma (which is usually about 3*sigma).

It is possible on older servers that -filter cubic was different and has changed since them.


P.S. As Bonzo points out below, do you mean -define filter:support. there is no -support

see
http://www.imagemagick.org/Usage/filter/#support
Last edited by fmw42 on 2012-11-23T17:35:52-07:00, edited 1 time in total.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Convert to fixed imagesize on Linux-Server

Post by Bonzo »

What is -support 1.0 as I can not find a referance to it on the IM options page?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert to fixed imagesize on Linux-Server

Post by fmw42 »

I think he meant -define filter:support. there is no -support

see
http://www.imagemagick.org/Usage/filter/#support
Helmut M.
Posts: 2
Joined: 2012-11-23T09:23:11-07:00
Authentication code: 6789

Re: Convert to fixed imagesize on Linux-Server

Post by Helmut M. »

Hello,

thank you for your reply. The commandline based on a line from the year 2004 and I dont know, what is -support 1.0

Here ist the Link to an image with black area: http://www.burscheider-tafel.de/158011.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert to fixed imagesize on Linux-Server

Post by fmw42 »

Copying some one else's code may not be the right thing for you and may not even be a correct or reasonable command.


Before getting fancy with profiles, see if this simpler command works for you. It works fine for me.

convert 158011.jpg -thumbnail 800x600 -gravity center -background white -extent 800x600 -density 72x72 -quality 75 158011_thumb.jpg

However, your input and output images are the same size, so why are you processing it at all. Furthermore it has no clip area defined. Why is there a black region? Do you need that to be trimmed off?

If you need it trimmed, try

convert 158011.jpg -fuzz 1% -trim +repage -thumbnail 800x600 -gravity center -background white -extent 800x600 -quality 75 158011_thumb2.jpg

The fuzz value can be adjusted. Use the smallest one that works.

-support 1.0 is incorrect for current IM. If it is needed then both -define:filter:support=1 and -filter cubic should come before the -thumbnail. The default filter (Lanczos for shrinking and Mitchell for enlarging) is probably a better generic filter than cubic. See http://www.imagemagick.org/Usage/filter/#support and http://www.imagemagick.org/Usage/filter/#summery and http://www.imagemagick.org/Usage/filter/nicolas/

Your use of unsharp 1x2 is not a very effective sharpener. If you really need to sharpen, then it can be added later (-unsharp 0x1 or -unsharp 0x2).
Post Reply