Resizing, Resolution and Quality in a single command
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Resizing, Resolution and Quality in a single command
Hello All,
We are upgrading our system from GM to IM and i installed IM latest version 6.8.8-2 (for more info you check below),
Version: ImageMagick 6.8.8-2 Q16 x86_64 2014-01-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff x xml zlib
Basically, what we want to do is, whenever a person uploads a original image we need to resize that image to a fixed pixels size like 1200x12000 and then reduce the Resolution to 72 DPI and last step is reduce the quality to 75. I wanted to do the whole process by executing in a single command. SO for that i am using a command like below, Can you look and let me know if that is correct or not?
convert image -resize 1200x1200 -density 72 -quality 75 resultimage
We are upgrading our system from GM to IM and i installed IM latest version 6.8.8-2 (for more info you check below),
Version: ImageMagick 6.8.8-2 Q16 x86_64 2014-01-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff x xml zlib
Basically, what we want to do is, whenever a person uploads a original image we need to resize that image to a fixed pixels size like 1200x12000 and then reduce the Resolution to 72 DPI and last step is reduce the quality to 75. I wanted to do the whole process by executing in a single command. SO for that i am using a command like below, Can you look and let me know if that is correct or not?
convert image -resize 1200x1200 -density 72 -quality 75 resultimage
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resizing, Resolution and Quality in a single command
"-resize 1200x12000" will reduce images taller than 1200 or wider than 12000 so they fit in a box 1200x12000. It won't enlarge.
snibgo's IM pages: im.snibgo.com
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Re: Resizing, Resolution and Quality in a single command
Sorry its 1200x1200 not 1200x12000
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing, Resolution and Quality in a single command
That should work fine and is about as compact as you can get. If you do not need any meta data, you can reduce the file size by adding -stripconvert image -resize 1200x1200 -density 72 -quality 75 resultimage
You do not say what file format. PNG does not support dpi only dpc. So you may want to add the appropriate units. For png output the density and units will then be converted to dpc from dpi.
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Re: Resizing, Resolution and Quality in a single command
Cool Thanks Fred.
Most probably we use jpg and jpeg formats. I think for these two formats all the commands (-resize, -density -quality) should work fine right?
Most probably we use jpg and jpeg formats. I think for these two formats all the commands (-resize, -density -quality) should work fine right?
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Re: Resizing, Resolution and Quality in a single command
In the old system we are using a command like below,
convert image -verbose -resize 1200x1200 -quality 75 +profile * +comment resultimage
i am not sure what is +profile and +comment. Can you please explain what is +profile and +comment and why we use use this?
convert image -verbose -resize 1200x1200 -quality 75 +profile * +comment resultimage
i am not sure what is +profile and +comment. Can you please explain what is +profile and +comment and why we use use this?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing, Resolution and Quality in a single command
+profile is used to remove any profile data. But I think you need to express it as +profile "*". See http://www.imagemagick.org/script/comma ... hp#profile
I am unaware of +comment. see http://www.imagemagick.org/script/comma ... hp#comment. I do not know any way to remove comments explicitly. I tried several variations. You can use -set comment "" to empty the field, but it still shows an empty comment filed.
You can also use -strip to remove any meta data, including profiles and comments.
I am unaware of +comment. see http://www.imagemagick.org/script/comma ... hp#comment. I do not know any way to remove comments explicitly. I tried several variations. You can use -set comment "" to empty the field, but it still shows an empty comment filed.
You can also use -strip to remove any meta data, including profiles and comments.
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Re: Resizing, Resolution and Quality in a single command
I am trying to execute a command like below to change the DPI, Resize, Quality and removing profile and comment
convert input.jpg/jpeg/tiff/png/tif -density 72 -verbose -resize 1200x1200 -quality 75 +profile "*" +comment output.jpg
My first question is, The command which i am using is correct or not and
Second question is, On what order the command is executed, what i mean is, first it will reduce the DPI to 72 then resize it to 1200x1200 and then change the quality or is it follow any different order the reason why i am asking is if we follow different order then there is change of changing the pixels size.
convert input.jpg/jpeg/tiff/png/tif -density 72 -verbose -resize 1200x1200 -quality 75 +profile "*" +comment output.jpg
My first question is, The command which i am using is correct or not and
Second question is, On what order the command is executed, what i mean is, first it will reduce the DPI to 72 then resize it to 1200x1200 and then change the quality or is it follow any different order the reason why i am asking is if we follow different order then there is change of changing the pixels size.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing, Resolution and Quality in a single command
helloworld wrote:I am trying to execute a command like below to change the DPI, Resize, Quality and removing profile and comment
convert input.jpg/jpeg/tiff/png/tif -density 72 -verbose -resize 1200x1200 -quality 75 +profile "*" +comment output.jpg
My first question is, The command which i am using is correct or not and
Second question is, On what order the command is executed, what i mean is, first it will reduce the DPI to 72 then resize it to 1200x1200 and then change the quality or is it follow any different order the reason why i am asking is if we follow different order then there is change of changing the pixels size.
The command is not proper. There is no +comment. You should remove all meta data that you want before resizing (for efficiency), then set the density and quality.
I would just do
convert input.jpg/jpeg/tiff/png/tif -verbose -strip -resize 1200x1200 -quality 75 -density 72x72 -units pixelsperinch output.jpg
Density does not apply until the end as does -quality (after the resize), but the placement should not matter. However, I try to do things in linear, logical order as appropriate to proper syntax. The density will not affect the resize and waits to be set until the image is written out.
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Re: Resizing, Resolution and Quality in a single command
Thanks a lot fred for explaining me very clearly.
convert input.jpg/jpeg/tiff/png/tif -verbose -strip -resize 1200x1200 -quality 75 -density 72x72 -units pixelsperinch output.jpg
May i know why you used -strip and why you removed +profile "*" in the command above.
convert input.jpg/jpeg/tiff/png/tif -verbose -strip -resize 1200x1200 -quality 75 -density 72x72 -units pixelsperinch output.jpg
May i know why you used -strip and why you removed +profile "*" in the command above.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing, Resolution and Quality in a single command
-strip removes all meta data, including profiles and comments. So there is no need to include +profile.
see
http://www.imagemagick.org/script/comma ... .php#strip
see
http://www.imagemagick.org/script/comma ... .php#strip
-
- Posts: 69
- Joined: 2013-05-22T09:42:33-07:00
- Authentication code: 6789
Re: Resizing, Resolution and Quality in a single command
Perfect. The command which you gave me works extra ordinary.