Page 1 of 1

Batch Resize to 150dpi

Posted: 2016-08-28T08:18:52-07:00
by dakheli54
I have many image files, each in different dpi,
I need to convert (resize) all of them to 150 dpi,
I mean :
if an image size is 1000x1000 @ 300 dpi, It must be resized to 500x500
if an image size is 1000x1000 @ 600 dpi, It must be resized to 250x250
So, Both resize and density change are needed,
How do I do this using Convert utility
changing density does not resize.
Thanks

Re: Batch Resize to 150dpi

Posted: 2016-08-28T08:36:17-07:00
by snibgo
Perhaps "-resample" does what you want. See http://www.imagemagick.org/script/comma ... p#resample

Re: Batch Resize to 150dpi

Posted: 2016-08-28T10:16:40-07:00
by GeeMack
dakheli54 wrote:I have many image files, each in different dpi,
I need to convert (resize) all of them to 150 dpi,
I mean :
if an image size is 1000x1000 @ 300 dpi, It must be resized to 500x500
if an image size is 1000x1000 @ 600 dpi, It must be resized to 250x250
This can be done very easily with ImageMagick 7. What IM version are you using and what operating system are you working on?

Edited: The simple answer is to use "-resample" as mentioned above by snibgo.

Re: Batch Resize to 150dpi

Posted: 2016-08-28T22:00:20-07:00
by dakheli54
snibgo & GeeMack,Thanks for prompt response,
A newbie in this, I use IM7 Convert utility in Win10.
from the description of -resample, a final resolution must be defined , don't know how to do it in batch operation.

Re: Batch Resize to 150dpi

Posted: 2016-08-28T22:50:15-07:00
by snibgo
To resample all the jpg files in your currect directory:

Code: Select all

magick mogrify -resample 150 *.jpg
But do a backup first in case this doesn't do what you want.

Re: Batch Resize to 150dpi

Posted: 2016-08-28T22:50:53-07:00
by GeeMack
dakheli54 wrote:from the description of -resample, a final resolution must be defined , don't know how to do it in batch operation.
If the number and size of images in your current working directory fit in your memory it can be as simple as this...

Code: Select all

magick mogrify -resample 150 *.jpg
That will change the density of all the JPGs in the current directory to 150dpi and resize them to match the new resolution. It will overwrite the existing images, so you may want to set aside backup copies. Also if you're processing JPGs there will be some loss due to compression. You can apply a setting something like "-quality 100" to save them at the best quality, but it's not lossless.