Page 1 of 1

single convert vs three convert - same result - same performance?

Posted: 2016-06-16T22:32:41-07:00
by agriz

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?

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-16T23:00:03-07:00
by snibgo
Your second command is pointless, as image4.png will be overwritten (ignoring the possibility of multiple outputs).

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-16T23:02:54-07:00
by agriz
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

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-16T23:03:57-07:00
by agriz
Please tell how the performance varies for a output, which is written in multiple convert against single convert

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-16T23:24:35-07:00
by snibgo
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

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-16T23:30:28-07:00
by agriz
So single convert is always better?

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-16T23:42:21-07:00
by fmw42
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.

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-17T00:17:52-07:00
by agriz
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?

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-17T00:50:15-07:00
by snibgo
agiz wrote:-extend 200x200
What is the error message? "-extend" is not a valid operation. Perhaps you intended "-extent".

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-17T00:54:57-07:00
by agriz
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.

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-17T01:34:47-07:00
by snibgo
"-extent" is sensitive to the "-compose" setting. Do you really want Dst_Over for extent?

Re: single convert vs three convert - same result - same performance?

Posted: 2016-06-17T09:41:53-07:00
by fmw42
Put -compose over before -extent.