Page 1 of 1

Image resizing via drag & drop

Posted: 2017-03-20T08:24:35-07:00
by Tabularas
Hello Folks,

At my work we are creating a pretty hefty amount of images in different sizes. To save some time and improve the workflow I wanted just to render the biggest size of the image and resize it by script into the needed sizes. I've searched some time now on the internet to find a solution to my problem and most postet one was use imagemagick via batchscript

I'm definitely not strong into scripting/coding and need help to get along my obstacles.

First of all I need to use relative paths. No absolute due to the fact that we are creating each day a lot of images and the paths are always changing (e.g. new File Version, Date, Folder etc.).

E.g.

I have following folder Structure

99165 --> media --> l (99165 is just one of a lot different foldernames due to the fact that they represent a different project)

What I want is that all Images from folder "l" will be resized into different sizes and put into the folders "m, s, xs". All of them need to have the same naming, so no renaming or additional suffix.

m --> image size 960x540
s --> image size 640x360
xs --> image size 240x135

I would really appreciate any help. :?

Re: Image resizing via drag & drop

Posted: 2017-03-20T09:01:50-07:00
by snibgo
So you want a script that resizes all images in one folders, writing the results in three other folders. Is that right?

This seems easy. For IM v6, something like:

Code: Select all

cd blah/blah/l
mogrify -path blah/blah/m -resize 960x540 *.png
mogrify -path blah/blah/s -resize 640x360 *.png
mogrify -path blah/blah/xs -resize 240x135 *.png
This will resize so the results just fit into boxes of the given width and height.

If all the files in "l" are images, you can use "*" instead of "*.png"

If your paths have spaces, you'll need to quote them.

I think the above should work for both Windows BAT or CMD, and bash. But it would help if you said what shell you use.

Also say what version IM you use.

Re: Image resizing via drag & drop

Posted: 2017-03-20T09:59:27-07:00
by fmw42
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/

Re: Image resizing via drag & drop

Posted: 2017-03-21T11:33:24-07:00
by RodneyRipo
snibgo wrote: 2017-03-20T09:01:50-07:00 So you want a script that resizes all images in one folders, writing the results in three other folders. Is that right?

This seems easy. For IM v6, something like:

Code: Select all

cd blah/blah/l
mogrify -path blah/blah/m -resize 960x540 *.png
mogrify -path blah/blah/s -resize 640x360 *.png
mogrify -path blah/blah/xs -resize 240x135 *.png
This will resize so the results just fit into boxes of the given width and height.

If all the files in "l" are images, you can use "*" instead of "*.png"

If your paths have spaces, you'll need to quote them.

I think the above should work for both Windows BAT or CMD, and bash. But it would help if you said what shell you use.

Also say what version IM you use.
If I'm using * it will resize .jpg, .png, and other image types as well? Just trying to clairfy.
Thanks!

Re: Image resizing via drag & drop

Posted: 2017-03-21T11:54:37-07:00
by snibgo
RodneyRipo wrote:If I'm using * it will resize .jpg, .png, and other image types as well?
It will try to resize all files in that directory. This is fine if all the files are images. If you also have .doc or whatever, those will fail, and might stop the conversion process.