Create several picture for one picture in one way

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
amaxime95
Posts: 1
Joined: 2012-12-05T08:39:03-07:00
Authentication code: 6789

Create several picture for one picture in one way

Post by amaxime95 »

Hello.

I've got an original image for which I want to create a series of image with a variety of resolutions:

Initially I was doing something like this ...

Code: Select all

convert '1.jpg' -gravity center -resize 190x168! -quality 70 '/converted/1.png'
convert '1.jpg' -gravity center -resize 320x240! -quality 100  '/converted/2.png''
But I want to do with one command
I tried this :

Code: Select all

convert '1.jpg' 
-write mpr:orig +delete 
mpr:orig -gravity center -resize 190x168! -quality 70 -write '/converted/1.png' +delete 
mpr:orig -gravity center -resize 320x240! -quality 100  '/converted/2.jpg' +delete
OR

Code: Select all

convert '1.jpg' 
-gravity center -resize 190x168! -quality 70 -write '/converted/1.png'  +delete	
-gravity center -resize 320x240! -quality 100  '/converted/2.jpg' 
But it doesn't work with error :

Code: Select all

convert: unable to open image `/converted/2.jpg': No such file or directory @ blob.c/OpenBlob/2480.
Any suggestions?

Thanks !
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create several picture for one picture in one way

Post by fmw42 »

You are referencing an absolute directory at the root of your tree. If you really want a subdirectory of your current directory, then leave off the / in your output image, so that it is a relative path

This is how I would do it. You can modify the command for your application


convert logo: -write mpr:image +delete \
\( mpr:image -resize 50% -write 1tmp1/logo1.jpg \) \
\( mpr:image -resize 25% -write 1tmp1/logo2.jpg \) \
null:

You should not need -gravity center
Post Reply