Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Feeding in Jpeg stream from pdf gives error

$
0
0
Hi,
I have a bunch of pdf files that are composed solely of scanned document jpegs. I am trying to shrink the file by pulling out each jpeg and processing it with Magick.NET. I am using PDFSharp to extract all the jpegs from each pdf into a stream object and then feeding the stream to Magick.Net.

The problem is that when I do it this way, IM does not recognize the file as a jpeg and wants to invoke a BLOB delegate and throws an exception.

I am sure that the stream contains a jpeg because I can save the string to a file and open it as an image. I can even re-read that file back into IM without issue. I have even tried to detect the mime type of the stream before feeding it into IM with urlmon.dll and it confirms that the data is an "image/pjpeg". I just can't instantiate a MagickImage from the stream!

What am I doing wrong here?

Viewing all articles
Browse latest Browse all 3693

Trending Articles