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?".
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-06-16T22:32:41-07:00
Code: Select all
convert image1.png [some process] image2.png
convert image3.png [some process] image4.png
convert image2.png -composite over image4.png
It uses three convert statement. If we write single convert for the above code, will both kind of codes require the same resource?
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-06-16T23:00:03-07:00
Your second command is pointless, as image4.png will be overwritten (ignoring the possibility of multiple outputs).
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-06-16T23:02:54-07:00
Lets assume this.
Code: Select all
convert image1.png [some process] image2.png
convert image3.png [some process] image4.png
convert image2.png index4.png -composite over image5.png
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-06-16T23:03:57-07:00
Please tell how the performance varies for a output, which is written in multiple convert against single convert
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-06-16T23:24:35-07:00
If you combine this into a single "convert image1.png image3.png {do_something} image5.png", you save:
- two invocations of the program
- one write to image2.png
- one write to image4.png
- one read of image2.png
- one read of image4.png
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-06-16T23:30:28-07:00
So single convert is always better?
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-06-16T23:42:21-07:00
It is faster, saves write times, and should produce the exact same result provide you do not save intermediates in lossy compression such as jpg in your original commands.
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-06-17T00:17:52-07:00
Sir,
Code: Select all
convert -size 500x500 xc:none ( image.png -resize 100x100 ) -gravity center -compose Dst_Over -composite ( image2.png -resize 200x200 -gravity center -extend 200x200 ) -gravity center -compose Dst_Over -composite output.png
not working.
Code: Select all
convert -size 500x500 xc:none ( image.png -resize 100x100 ) -gravity center -compose Dst_Over -composite ( image2.png -resize 200x200 ) -gravity center -compose Dst_Over -composite output.png
working. Why the above one is not working?
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-06-17T00:50:15-07:00
agiz wrote: -extend 200x200
What is the error message? "-extend" is not a valid operation. Perhaps you intended "-extent".
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-06-17T00:54:57-07:00
it was -extent. I wrongly typed here.
There is no error message, The image (image2) just becomes white in the output.
If i swap and add -extent to image1 again image1 becomes white and image2 works. If i remove -extent it works good.
To use extent, do i need -gravity center?
-gravity center cause the trouble i guess.
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-06-17T01:34:47-07:00
"-extent" is sensitive to the "-compose" setting. Do you really want Dst_Over for extent?
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-06-17T09:41:53-07:00
Put -compose over before -extent.