Page 1 of 1

How can i generate multiple images in a single command

Posted: 2010-01-27T00:10:14-07:00
by satya
Hi,
How can i generate multiple(output)images in a single (input) images?

I'm creating multiple size thumbnails with image magic multiple calls. Below is code.

Code: Select all

 convert 7070248.jpeg -resize 323x242 -quality 100 1272.jpeg
 convert 7070248.jpeg -resize 40x28 -quality 100 1273.jpeg
 convert 7070248.jpeg -resize 445x335 -quality 100 1274.jpeg
I want create all(1272.jpeg,1273.jpeg,1274.jpeg) of image in a single command. May be my idea is not correct.

Code: Select all

 convert 7070248.jpeg -resize 323x242 -quality 100 1272.jpeg -resize 323x242 -quality 100 1273.jpeg -resize 323x242 -quality 100 1274.jpeg
or 
 convert 7070248.jpeg -resize 323x242  40x28 445x335 -quality 100 1272.jpeg 1273.jpeg 1274.jpeg
Is this possible to generate multiple images in a single input via image magic.

Please let me know your suggestion or though. this is very important for me.

Thanks in advance.:)

Re: How can i generate multiple images in a single command

Posted: 2010-01-27T01:05:21-07:00
by Bonzo
Try:

Code: Select all

convert 7070248.jpeg ( +clone -resize 323x242  -quality 100 -write 1272.jpg +delete ) ( +clone -resize 445x335 -quality 100 -write 1274.jpg +delete )  -resize 40x28 -quality 100 1273.jpg 

Re: How can i generate multiple images in a single command

Posted: 2010-01-27T02:56:05-07:00
by satya
Thanks for quick response.

What happened if i remove "+delete" from command.

after my research this command increase performance. what is your thinking for using this command.

Thanks

Re: How can i generate multiple images in a single command

Posted: 2010-01-27T10:58:45-07:00
by Bonzo
Some info on delete here: http://www.imagemagick.org/script/comma ... php#delete
I would check if you remove the +delete that you are actualy modifying the input image and not the last image created.
I do not know you are using the code but it may take up space in the memory or tempory folder. If you are not modifying very large images the memory and tempory images should be deleted automaticaly by the system ?

Here is a different method is it any quicker ?

Code: Select all

convert 7070248.jpeg -write mpr:image +delete ( mpr:image -resize 323x242  -quality 100 -write 1272.jpg ) ( mpr:image -resize 445x335 -quality 100 -write 1274.jpg ) ( mpr:image -resize 40x28 -quality 100 1273.jpg )

Re: How can i generate multiple images in a single command

Posted: 2010-01-27T11:21:29-07:00
by satya
Thanks for nice replay. This would help me to implement right application.

Re: How can i generate multiple images in a single command

Posted: 2018-02-11T05:54:04-07:00
by tkp
Bonzo wrote: 2010-01-27T10:58:45-07:00 Here is a different method is it any quicker ?
Tested both nesting method to crop a 10000 x 10000 image to 2048 x 2048 tiles.

- original bash for loop : 191s
- mpr:image method : 32s
- +clone method : 32s

So both method seem to be equivalent for this use case, and are huge time saver.

Thanks both for asking and answering this helpful question !