What is the difference between 1 and 2?
1. convert abc.png -draw "fill black rectangle 232,689,1843,1154" -draw "fill black rectangle 23,69,143,154" abc_result.tiff
2. convert abc.png -draw "fill black rectangle 232,689,1843,1154 fill black rectangle 23,69,143,154" abc_result.tiff
if i use draw command twice or more will it create performance delay or works as same??
Want to know the difference?
Re: Want to know the difference?
Do both commands work?
If it was me I would run a test with a timer and see if there was a speed difference.
If it was me I would run a test with a timer and see if there was a speed difference.
Re: Want to know the difference?
Hello,
Yes both command works . I just need to understand which is the most efficient method to do so?
1. give all co-ordinates in one -draw
2. give co-ordinates separately.
I ran the test with different type of images and checked out time but it is not very concrete and vary but with very very large number of conversion this may effect the performance.I don't have huge amount of data. but still what is the best practice to invoke -draw?
So please help me to know which is the best practice to invoke the command and why?
Thanks.
Yes both command works . I just need to understand which is the most efficient method to do so?
1. give all co-ordinates in one -draw
2. give co-ordinates separately.
I ran the test with different type of images and checked out time but it is not very concrete and vary but with very very large number of conversion this may effect the performance.I don't have huge amount of data. but still what is the best practice to invoke -draw?
So please help me to know which is the best practice to invoke the command and why?
Thanks.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Want to know the difference?
I expect the second method, with a single "-draw", is slightly faster. If this is important, you'll need to measure it. You may find the performance difference only becomes apparent with hundreds of small drawn objects.
snibgo's IM pages: im.snibgo.com
Re: Want to know the difference?
Thanks for the reply . It really helps . I will test it with large number of objects. Thank you
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Want to know the difference?
I've done a timing test.
Case 1:
This was done 50,000 times in a single convert. It took 11 seconds.
Case 2:
This was done 50,000 times in a single "-draw" in a convert. It took 2 seconds.
I'm surprised at how large the difference is. The "-draw" itself has a large overhead, and better performance comes from combining multiple draws into one.
In this test, my drawn objects are deliberately small. When they are larger, the speed improvement is far less. For example, ten thousand 20x20 rectangles have timings of 9 seconds and 7 seconds.
The full Windows BAT script for my test was:
Case 1:
Code: Select all
-draw "fill red rectangle 10,10,12,12"
-draw "fill red rectangle 100,100,102,102"
Case 2:
Code: Select all
fill red rectangle 10,10,12,12
fill red rectangle 100,100,102,102
I'm surprised at how large the difference is. The "-draw" itself has a large overhead, and better performance comes from combining multiple draws into one.
In this test, my drawn objects are deliberately small. When they are larger, the speed improvement is far less. For example, ten thousand 20x20 rectangles have timings of 9 seconds and 7 seconds.
The full Windows BAT script for my test was:
Code: Select all
%IM%convert -size 300x300 xc:White ds.png
echo ds.png >ds.scr
echo off
( for /L %%i in (1,1,50000) do (
echo -draw "fill red rectangle 10,10,12,12"
echo -draw "fill red rectangle 100,100,102,102"
)
) >>ds.scr
echo on
call StopWatch
%IM%convert "@ds.scr" NULL:
call StopWatch
del ds2.scr
echo off
( for /L %%i in (1,1,50000) do (
echo fill red rectangle 10,10,12,12
echo fill red rectangle 100,100,102,102
)
) >>ds2.scr
echo on
call StopWatch
%IM%convert ds.png -draw "@ds2.scr" NULL:
call StopWatch
snibgo's IM pages: im.snibgo.com
Re: Want to know the difference?
Hi snibgo,
Thanks for the reply. It was really helpful.
Thanks for the reply. It was really helpful.