Page 1 of 1

Convert very slow when using TGA:- (ImageMagick 6.9.1-1)

Posted: 2015-04-11T04:01:30-07:00
by xyri
Using TGA:- with convert is really slow compared to saving the output as a TGA file:

$ time convert.exe test.png test.tga
0.00s user 0.00s system 0% cpu 2.708 total

$ convert.exe test.png TGA:- > test.tga
0.00s user 0.00s system 0% cpu 49.859 total

Both of these commands produces identical output file but the second one (and the one I'm needing when piping image data to an another program) takes ~18x more time and it maxes out one CPU core for the whole ~49.9 seconds. I ran these tests under Cygwin but the same thing happens when running via Windows command prompt. Input file was a random 4000x4000 ~6.6 MB PNG file but I have also tested this with several other files having the same kind of of results.

$ convert.exe -version
Version: ImageMagick 6.9.1-1 Q16 x64 2015-03-20 (ImageMagick-6.9.1-1-Q16-x64-static.exe)

System specs: Windows 7 SP1, i7 4790K, 16GB, SSD


Any help to solve this would be appreciated. Thank you.

Re: Convert very slow when using TGA:- (ImageMagick 6.9.1-1)

Posted: 2015-04-11T04:05:21-07:00
by snibgo
I doubt if ImageMagick developers can do much about this (unless IM is doing something weird). Redirecting stdout will always be slower than directly writing to a file.

Re: Convert very slow when using TGA:- (ImageMagick 6.9.1-1)

Posted: 2015-04-11T04:17:11-07:00
by xyri
snibgo wrote:I doubt if ImageMagick developers can do much about this (unless IM is doing something weird). Redirecting stdout will always be slower than directly writing to a file.
It's not with any other image format tho (same input file than in my first post):

JPEG:

$ convert.exe test.png test.jpg
0.00s user 0.00s system 0% cpu 0.872 total

$ convert.exe test.png JPEG:- > test.jpg
0.00s user 0.00s system 0% cpu 0.660 total

TIF:

$ convert.exe test.png test.tif
0.00s user 0.00s system 0% cpu 7.014 total

$ convert.exe test.png TIF:- > test.tif
0.00s user 0.01s system 0% cpu 6.996 total

BMP:

$ convert.exe test.png test.bmp
0.00s user 0.00s system 0% cpu 0.701 total

$ convert.exe test.png BMP:- > test.bmp
0.00s user 0.00s system 0% cpu 0.662 total


With all these tests the STDOUT version is actually faster, so I don't think the problem is in writing to STDOUT but something that happens before it.

Re: Convert very slow when using TGA:- (ImageMagick 6.9.1-1)

Posted: 2015-04-11T04:20:09-07:00
by snibgo
Ah, well, that's blown my theory. Sorry. Perhaps a developer can comment.

Re: Convert very slow when using TGA:- (ImageMagick 6.9.1-1)

Posted: 2015-04-11T04:58:11-07:00
by magick
We can reproduce the problem you posted and we're testing a patch in ImageMagick 6.9.1-2 Beta, available within a few days. Thanks.