Page 1 of 1

Resize images to a certain size?

Posted: 2019-09-10T18:53:09-07:00
by traoiu
Will ImageMagick be able to resize large amount of images to a certain size ( Eg; 40 KB) using optimization compression while keeping the image height and width,however if it's unable to do so , certain dpi resizing will happen which then allows it to reach target size?

Re: Resize images to a certain size?

Posted: 2019-09-10T19:19:29-07:00
by snibgo
You would need a script for that.

Re: Resize images to a certain size?

Posted: 2019-09-10T19:32:14-07:00
by traoiu
snibgo wrote: 2019-09-10T19:19:29-07:00 You would need a script for that.
If I had a script ,I would be able to do that i'm assuming?


Thanks for the reply

Re: Resize images to a certain size?

Posted: 2019-09-10T20:27:13-07:00
by fmw42
That is possible with JPG output. See -define jpeg:extent={size} at https://imagemagick.org/Usage/formats/#jpg_write

DPI only affects print size, not raster image size unless you change width and height accordingly.

Re: Resize images to a certain size?

Posted: 2019-09-10T21:38:02-07:00
by traoiu
Just clarifying, so does the width/height change if I were to use the cmd -define jpeg:extent={size} or something else happens?
Sorry if im being confusing and thank you for replying.

Re: Resize images to a certain size?

Posted: 2019-09-10T22:12:59-07:00
by fmw42
The width and height do not change. That define will tell imagemagick the size you want and it will iterate changing the quality value (compression) until it reaches that image size. But it is limited to JPG output only.