memorystream to system.drawing.image with transparency
I have a pdf with an embedded image and using itextsharp I 开发者_开发问答have read the image into a memorystream (after checking for subtype image).
byte[] bytes = TextSharp.text.pdf.PdfReader.GetStreamBytesRaw((iTextSharp.text.pdf.PRStream)pdfStream);
after that I use
using (System.IO.MemoryStream memStream = new System.IO.MemoryStream(bytes))
{
memStream.Position = 0;
System.Drawing.Image img = System.Drawing.Image.FromStream(memStream, true, true);
}
Further I save the image into a png using
img.Save(@"mypath to the file.png", ImageFormat.Png);
#
The problem is most of the images are coming alright..however some of them are more like negatives..please see the image here.
http://pdfaid.com/prasad.bmp (similar result with png and gif)
Can someone please guide me how to solve this?
NOTE: instead of png I tried jpg and gif but didnot make a difference.
Thank you in advance, Prasad.
Read through the posts here and hopefully they'll walk you through some answers. One person said that you might be seeing a mask of some sort and another said you might be see an image with some inverted color channels. If you can post a specific PDF we might be able to help you more.
精彩评论