PDA

View Full Version : speed up my imagemagick/qt editor



yoniekai
21st February 2008, 02:06
i have a Qt application that uses imagemagick to edit the image. it works but the processing is very slow. i first display the image using QLabel (QImage and QPixmap), then get the filename to create a Magick::Image, convert to Magick::Blob, edit it, and converting it back to QPixmap and display in the label.

the problem is its slow. for example if i were to apply a blur effect to 1024x768 image it takes about 5 seconds to complete. this is very slow. the same goes for flipping or rotating images. zooming images as well. i really want to speed up this application. i am mighty interested for optimization advices. thanks!

jacek
21st February 2008, 20:10
I would use a profiler (or at least clock() function) to see where exactly the time is spent.

yoniekai
22nd February 2008, 00:51
hm, yes i would like to try that, could you elaborate on that concept?

jacek
22nd February 2008, 15:00
http://wiki.qtcentre.org/index.php?title=Profiling

openArms
5th April 2011, 10:44
hi, everybody
i m trying to read dpx image through IM, but failed to do so .
any help would be appreciated.
my code:
Image image;
Blob blob;
QFileInfo fileInfo(file);
//read the file data
image.read(filename.toStdString());
image.write(&blob);
const QByteArray imageData((char *)blob.data(),blob.length());
QPixmap pixmap;
pixmap.loadFromData(imageData);

SixDegrees
5th April 2011, 12:15
If the application of the blur is what's taking all the time, the problem lies with ImageMagick; there is nothing you can do within Qt that will have any impact on ImageMagick performance.

You should determine where, exactly, your program is spending its time. Use of a profiler, already mentioned, will be useful. Simply dumping print statements to the console periodically ("file opened...file read...image created...image processed...etc) will also give you a feel for which steps are taking the longest.