You are not logged in.
Inside a Qt application I'm using ImageMagick to create an image (from variable text) on-the-fly and save it to the hard drive. Then right afterwards I'm telling Qt to load that image in an object (called currQorA). I know it would be more efficient to skip the hard-drive-writing part and pipe the output of ImageMagick directly to the Qt object. I just don't know how to do it. Here's my code as it currently stands,
sprintf(str, "convert -gravity Center -background transparent -pointsize 12 -size 500x caption:'%s' /var/tmp/text.png", variable_string);
system(str);
currQorA->setIcon(QIcon(QPixmap("/var/tmp/text.png").scaled(500, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
currQorA->setIconSize(QSize(500, 200));
Does anyone know how to pipe the ImageMagick image directly into the button (without writing to a file on the HDD first)? Thanks!
Offline
Two things I found with a quick google search:
http://www.imagemagick.org/Magick++/
http://lists.trolltech.com/qt-interest/ … 394-0.html
The second post describes the opposite way: QPixmap -> Image, you need Image -> QPixmap. But that shouldn´t be that much more difficult.
€: Should have read the third thing I opened:
http://studio.imagemagick.org/pipermail … 21250.html
both conversions
Last edited by draugdel (2010-06-05 09:33:44)
Offline