MagickGetImageBlob and GetCubeInfo slow?

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
Jumby

MagickGetImageBlob and GetCubeInfo slow?

Post 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
Last edited by Jumby on 2008-09-26T10:20:06-07:00, edited 1 time in total.
Jumby

Re: MagickGetImageBlob anf GetCubeInfo slow?

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickGetImageBlob and GetCubeInfo slow?

Post 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.
Post Reply