Page 1 of 1

MagickGetImageBlob and GetCubeInfo slow?

Posted: 2008-09-26T09:53:52-07:00
by Jumby
I have been profiling an application of mine that basically reads in an image, resizes it and then uses this resized image for stuff.

The order of events is (pseudo):

status = MagickReadImageBlob(wand,img_ptr,total_size);
status = MagickResizeImage(wand,data->x,data->y,BoxFilter,1);
new_img_ptr = MagickGetImageBlob(wand,&new_size);

When I run this under callgrind, I see a ton of time spent inside MagickGetImageBlob. Considering just MagickGetImageBlob, 92.32% is spent inside one function: GetCubeInfo(). When I pull out to consider the total time inside MagickGetImageBlob, it amounts to 7.64% of the application time, where 7.02% is spent inside GetCubeInfo().

This applications first design goal is speed, so obviously, if I can reduce or eliminate that 7%, it would benefit me greatly. Does anyone have any ideas on how to achieve this?

ImageMagick6.2.9 if that matters.

Any help would be appreciated,
--Jumby

Re: MagickGetImageBlob anf GetCubeInfo slow?

Posted: 2008-09-26T10:18:57-07:00
by Jumby
Sorry, the stack is:

MagickGetImageBlob 100%
ImageToBlob 100%
WriteImage 99.95%
WriteGIFImage 99.92%
SetImageType 99.71%
QuantizeImage 99.64%
GetCubeInfo 92.32%

Percentages indicate total time spent in each function.

--Jumby

Re: MagickGetImageBlob and GetCubeInfo slow?

Posted: 2008-09-26T10:36:04-07:00
by magick
The majority of the time is spent in the color reduction method that converts truecolor images to colormapped. You might get a speed-up by using the latest ImageMagick release, 6.4.3-10. Otherwise you can try speeding up the process by calling MagickQuantizeImage() before MagickGetImageBlob() and using a small tree-depth of 4.