PDA

View Full Version : How to convert multi page Magick++ Image to QImage?



eadorean
8th September 2013, 17:00
Hello,

I convert Magick++ single page Image to QT image (QPixmap, actually, but could be QImage as well) with:


Blob my_blob_1;
Image img1;
img1.magick("MNG"); // or PNG
img1.write(&my_blob_1);
const QByteArray imageData1((char*)(my_blob_1.data()),my_blob_1.len gth());
item1p.loadFromData(imageData1);
item1 = Scene->addPixmap(QPixmap(item1p));

where:

QPixmap item1p;
QGraphicsScene *Scene;
QGraphicsPixmapItem *item1;

My question is: how could I do that with multi page Image?
Below, I have a multipage image in a vector, I manipulate it with STL algorithms, but I can not find a way to output it to QT Image.
Magick++ writes it out to a single blob.
I would need to write to separate blobs for each page. Do I, or is there other way?
vector<Image> to QVector<QImage>


Blob my_blob_111;
vector<Image> imageListmpp;
writeImages( imageListmpp.begin(), imageListmpp.end(), &my_blob_111 );
Image aaa;
aaa.read(my_blob_111);
aaa.write( "D:/test/aaa.pdf" );

I welcome any suggestion.

Thanks!

ChrisW67
8th September 2013, 21:24
If you want only one of the images frames in the Magick Image in the Magick Blob then only give writeImage() a single iterator value. I don't see what this has to do with Qt.

eadorean
9th September 2013, 18:28
I want to convert vector<Image> to QVector<QImage>.
This is the main scope.

If the solution is to write the multipage image to separate blobs, than you are right. It has nothing to do with QT.
But I do not know how to write every frame of a variable size (the size is known when the user opens the file) multipage image to multiple blobs. (each frame in separate blob).

Thanks.