Ashish, ashish wrote > I am using ImageRenderInfo for parsing PDFs and getting ImageBytes but for > my perticular PDF file which has one big PNG image in it nothing else, the > ImageRenderInfo.getImage() gives nothing if I save the bytes as .png on > filesystem the image is all black. > > [...] > 2.pdf <http://itext-general.2136553.n4.nabble.com/file/n4658740/2.pdf> > > 1.pdf <http://itext-general.2136553.n4.nabble.com/file/n4658740/1.pdf> > > Each PDF only has one image in it nothing else. I am trying to get the > image bytes from both the PDFs to see if these are same images or > different. All I get is array of 0000000000000 bytes.
The respective image itself indeed is purely black! You merely forgot one thing, images in PDFs can be accompanied by additional information which act as an alpha channel mask on the original image, and in your case all interesting data is encoded in the mask. You can retrieve the mask from the PdfImageObject image like this: PdfDictionary imageDictionary = image.getDictionary(); PRStream maskStream = (PRStream) imageDictionary.getAsStream(PdfName.SMASK); if (maskStream != null) { PdfImageObject maskImage = new PdfImageObject(maskStream); [... process mask image object ...] } For details cf. the /SMask entry in table 89 of the PDF specification ISO 32000-1. And also please are aware that there are other mask types, too. Regards, Michael -- View this message in context: http://itext-general.2136553.n4.nabble.com/ImageRenderInfo-getImage-return-empty-bytes-tp4658726p4658742.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php