Image resizing via drag & drop

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
Tabularas
Posts: 1
Joined: 2017-03-20T07:26:03-07:00
Authentication code: 1151

Image resizing via drag & drop

Post 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. :?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image resizing via drag & drop

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image resizing via drag & drop

Post 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/
RodneyRipo
Posts: 1
Joined: 2017-03-21T10:03:00-07:00
Authentication code: 1151

Re: Image resizing via drag & drop

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image resizing via drag & drop

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply