Are you trying to load a PdfImage from a jpeg image? If so, you should use PdfImage::LoadFromBuffer(buffer), which will automatically fill the image with the jpeg content. PdfImage::SetData(buffer, width, height, format) is specialized to load an image from raw pixel data, as the PdfPixelFormat enum parameter should have suggested. It's a new feature in 0.10.x. Other input definitions are supported through PdfImage::SetDataRaw(buffer, info), but not recommended for users that don't know what they are doing.
On Fri, 14 Jul 2023 at 16:46, Sandro Mani <manisan...@gmail.com> wrote: > > Hi > > I'm migrating some podofo-0.9.x code to 0.10.x. I have code writing > encoded image streams like this: > > QByteArray data; > QBuffer buffer(&data); > img.save(&buffer, "jpg", settings.compressionQuality); > PoDoFo::PdfName > dctFilterName(PoDoFo::PdfFilterFactory::FilterTypeToName(PoDoFo::ePdfFilter_DCTDecode)); > pdfImage.GetObject()->GetDictionary().AddKey(PoDoFo::PdfName::KeyFilter, > dctFilterName); > PoDoFo::SpanStreamDevice is(data.data(), data.size()); > pdfImage->SetData(is, width, height, pixelFormat); > > which I'm having difficulties to adapt to 0.10.x as the API changed > substantially here. Can someone provide an example? > > Thanks > Sandro > > > > _______________________________________________ > Podofo-users mailing list > Podofo-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/podofo-users _______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users