Thank you for the response. If I write the original image back to the document, it does not corrupt the document. However, if I change the quality settings on a JPEG it does corrupt the document.
I realized I left an important bit out of the code, here is everything:
static void ResampleDoc(String srcDoc, String destDoc)
{
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(@"C:\Users\sean.martin\Documents\Visual Studio 2010\Projects\AsposePDFTesting\_SharedLibraries\Aspose.Total.lic");
Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Document</span> doc <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Document</span>(srcDoc);
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">"Optimizing {0} /r/n"</span>, srcDoc));
<span style="color: rgb(147, 199, 99);">byte</span>[] outImg;
<span style="color: rgb(103, 140, 177);">MemoryStream</span> outStrm;
<span style="color: rgb(103, 140, 177);">MemoryStream</span> imgStream;
Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Page</span> pg;
<span style="color: rgb(147, 199, 99);">for</span> (<span style="color: rgb(147, 199, 99);">int</span> p <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">1</span>; p <span style="color: rgb(232, 226, 183);"><=</span> doc<span style="color: rgb(232, 226, 183);">.</span>Pages<span style="color: rgb(232, 226, 183);">.</span>Count; p<span style="color: rgb(232, 226, 183);">++</span>)
{
pg <span style="color: rgb(232, 226, 183);">=</span> doc<span style="color: rgb(232, 226, 183);">.</span>Pages[p];
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">"Processing Page {0}"</span>, p));
<span style="color: rgb(147, 199, 99);">for</span> (<span style="color: rgb(147, 199, 99);">int</span> i <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">1</span>; i <span style="color: rgb(232, 226, 183);"><=</span> pg<span style="color: rgb(232, 226, 183);">.</span>Resources<span style="color: rgb(232, 226, 183);">.</span>Images<span style="color: rgb(232, 226, 183);">.</span>Count; i<span style="color: rgb(232, 226, 183);">++</span>)
{
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">" Processing Img {0}"</span>, p));
Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">XImage</span> img <span style="color: rgb(232, 226, 183);">=</span> pg<span style="color: rgb(232, 226, 183);">.</span>Resources<span style="color: rgb(232, 226, 183);">.</span>Images[i];
<span style="color: rgb(147, 199, 99);">using</span> (imgStream <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">MemoryStream</span>())
{
img<span style="color: rgb(232, 226, 183);">.</span>Save(imgStream, <span style="color: rgb(103, 140, 177);">ImageFormat</span><span style="color: rgb(232, 226, 183);">.</span>Jpeg);
outImg <span style="color: rgb(232, 226, 183);">=</span> SetJPEGCompression(imgStream<span style="color: rgb(232, 226, 183);">.</span>ToArray(), <span style="color: rgb(255, 205, 34);">40</span>);
<span style="color: rgb(147, 199, 99);">using</span> (outStrm <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">MemoryStream</span>(outImg))
{
<span style="color: rgb(147, 199, 99);">if</span> (outStrm<span style="color: rgb(232, 226, 183);">.</span>Length <span style="color: rgb(232, 226, 183);">></span> <span style="color: rgb(255, 205, 34);">0</span> <span style="color: rgb(232, 226, 183);">&&</span> imgStream<span style="color: rgb(232, 226, 183);">.</span>Length <span style="color: rgb(232, 226, 183);">></span> outStrm<span style="color: rgb(232, 226, 183);">.</span>Length)
{
pg<span style="color: rgb(232, 226, 183);">.</span>Resources<span style="color: rgb(232, 226, 183);">.</span>Images<span style="color: rgb(232, 226, 183);">.</span>Replace(i, outStrm);
outStrm<span style="color: rgb(232, 226, 183);">.</span>Flush();
outStrm<span style="color: rgb(232, 226, 183);">.</span>Close();
}
}
}
}
}
doc<span style="color: rgb(232, 226, 183);">.</span>Pages<span style="color: rgb(232, 226, 183);">.</span>Flatten();
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">"Saving!! {0} /r/n"</span>, srcDoc));
doc<span style="color: rgb(232, 226, 183);">.</span>Save(destDoc);
}
<span style="color: rgb(147, 199, 99);">public</span> <span style="color: rgb(147, 199, 99);">static</span> <span style="color: rgb(147, 199, 99);">byte</span>[] SetJPEGCompression(<span style="color: rgb(147, 199, 99);">byte</span>[] srcBytes, <span style="color: rgb(147, 199, 99);">long</span> compressionLevel)
{
<span style="color: rgb(103, 140, 177);">ImageConverter</span> ic <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">ImageConverter</span>();
<span style="color: rgb(103, 140, 177);">Image</span> image <span style="color: rgb(232, 226, 183);">=</span> (<span style="color: rgb(103, 140, 177);">Image</span>)ic<span style="color: rgb(232, 226, 183);">.</span>ConvertFrom(srcBytes);
<span style="color: rgb(147, 199, 99);">if</span> (image<span style="color: rgb(232, 226, 183);">.</span>RawFormat<span style="color: rgb(232, 226, 183);">.</span>Guid <span style="color: rgb(232, 226, 183);">==</span> System<span style="color: rgb(232, 226, 183);">.</span>Drawing<span style="color: rgb(232, 226, 183);">.</span>Imaging<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">ImageFormat</span><span style="color: rgb(232, 226, 183);">.</span>Jpeg<span style="color: rgb(232, 226, 183);">.</span>Guid)
{
<span style="color: rgb(147, 199, 99);">if</span> (compressionLevel <span style="color: rgb(232, 226, 183);"><</span> <span style="color: rgb(255, 205, 34);">0</span>)
{
compressionLevel <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">0</span>;
}
<span style="color: rgb(147, 199, 99);">else</span> <span style="color: rgb(147, 199, 99);">if</span> (compressionLevel <span style="color: rgb(232, 226, 183);">></span> <span style="color: rgb(255, 205, 34);">100</span>)
{
compressionLevel <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">100</span>;
}
<span style="color: rgb(103, 140, 177);">ImageCodecInfo</span> jgpEncoder <span style="color: rgb(232, 226, 183);">=</span> GetEncoder(<span style="color: rgb(103, 140, 177);">ImageFormat</span><span style="color: rgb(232, 226, 183);">.</span>Jpeg);
System<span style="color: rgb(232, 226, 183);">.</span>Drawing<span style="color: rgb(232, 226, 183);">.</span>Imaging<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Encoder</span> myEncoder <span style="color: rgb(232, 226, 183);">=</span> System<span style="color: rgb(232, 226, 183);">.</span>Drawing<span style="color: rgb(232, 226, 183);">.</span>Imaging<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Encoder</span><span style="color: rgb(232, 226, 183);">.</span>Quality;
<span style="color: rgb(103, 140, 177);">EncoderParameters</span> myEncoderParameters <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">EncoderParameters</span>(<span style="color: rgb(255, 205, 34);">1</span>);
<span style="color: rgb(103, 140, 177);">EncoderParameter</span> myEncoderParameter <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">EncoderParameter</span>(myEncoder, compressionLevel);
myEncoderParameters<span style="color: rgb(232, 226, 183);">.</span>Param[<span style="color: rgb(255, 205, 34);">0</span>] <span style="color: rgb(232, 226, 183);">=</span> myEncoderParameter;
<span style="color: rgb(147, 199, 99);">using</span> (<span style="color: rgb(103, 140, 177);">MemoryStream</span> ms <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">MemoryStream</span>())
{
image<span style="color: rgb(232, 226, 183);">.</span>Save(ms, jgpEncoder, myEncoderParameters);
<span style="color: rgb(147, 199, 99);">return</span> ms<span style="color: rgb(232, 226, 183);">.</span>ToArray();
}
}
<span style="color: rgb(147, 199, 99);">else</span>
{
<span style="color: rgb(147, 199, 99);">return</span> srcBytes;
}
}
<span style="color: rgb(147, 199, 99);">public</span> <span style="color: rgb(147, 199, 99);">static</span> <span style="color: rgb(103, 140, 177);">ImageCodecInfo</span> GetEncoder(<span style="color: rgb(103, 140, 177);">ImageFormat</span> format)
{
<span style="color: rgb(103, 140, 177);">ImageCodecInfo</span>[] codecs <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(103, 140, 177);">ImageCodecInfo</span><span style="color: rgb(232, 226, 183);">.</span>GetImageDecoders();
<span style="color: rgb(147, 199, 99);">foreach</span> (<span style="color: rgb(103, 140, 177);">ImageCodecInfo</span> codec <span style="color: rgb(147, 199, 99);">in</span> codecs)
{
<span style="color: rgb(147, 199, 99);">if</span> (codec<span style="color: rgb(232, 226, 183);">.</span>FormatID <span style="color: rgb(232, 226, 183);">==</span> format<span style="color: rgb(232, 226, 183);">.</span>Guid)
{
<span style="color: rgb(147, 199, 99);">return</span> codec;
}
}
<span style="color: rgb(147, 199, 99);">return</span> <span style="color: rgb(147, 199, 99);">null</span>;
}
static void ResampleDoc(String srcDoc, String destDoc)
{
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(@“C:\Users\sean.martin\Documents\Visual Studio 2010\Projects\AsposePDFTesting_SharedLibraries\Aspose.Total.lic”);
Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Document</span> doc <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Document</span>(srcDoc);
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">"Optimizing {0} /r/n"</span>, srcDoc));
<span style="color: rgb(147, 199, 99);">byte</span>[] outImg;
<span style="color: rgb(103, 140, 177);">MemoryStream</span> outStrm;
<span style="color: rgb(103, 140, 177);">MemoryStream</span> imgStream;
Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Page</span> pg;
<span style="color: rgb(147, 199, 99);">for</span> (<span style="color: rgb(147, 199, 99);">int</span> p <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">1</span>; p <span style="color: rgb(232, 226, 183);"><=</span> doc<span style="color: rgb(232, 226, 183);">.</span>Pages<span style="color: rgb(232, 226, 183);">.</span>Count; p<span style="color: rgb(232, 226, 183);">++</span>)
{
pg <span style="color: rgb(232, 226, 183);">=</span> doc<span style="color: rgb(232, 226, 183);">.</span>Pages[p];
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">"Processing Page {0}"</span>, p));
<span style="color: rgb(147, 199, 99);">for</span> (<span style="color: rgb(147, 199, 99);">int</span> i <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">1</span>; i <span style="color: rgb(232, 226, 183);"><=</span> pg<span style="color: rgb(232, 226, 183);">.</span>Resources<span style="color: rgb(232, 226, 183);">.</span>Images<span style="color: rgb(232, 226, 183);">.</span>Count; i<span style="color: rgb(232, 226, 183);">++</span>)
{
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">" Processing Img {0}"</span>, p));
Aspose<span style="color: rgb(232, 226, 183);">.</span>Pdf<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">XImage</span> img <span style="color: rgb(232, 226, 183);">=</span> pg<span style="color: rgb(232, 226, 183);">.</span>Resources<span style="color: rgb(232, 226, 183);">.</span>Images[i];
<span style="color: rgb(147, 199, 99);">using</span> (imgStream <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">MemoryStream</span>())
{
img<span style="color: rgb(232, 226, 183);">.</span>Save(imgStream, <span style="color: rgb(103, 140, 177);">ImageFormat</span><span style="color: rgb(232, 226, 183);">.</span>Jpeg);
outImg <span style="color: rgb(232, 226, 183);">=</span> SetJPEGCompression(imgStream<span style="color: rgb(232, 226, 183);">.</span>ToArray(), <span style="color: rgb(255, 205, 34);">40</span>);
<span style="color: rgb(147, 199, 99);">using</span> (outStrm <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">MemoryStream</span>(outImg))
{
<span style="color: rgb(147, 199, 99);">if</span> (outStrm<span style="color: rgb(232, 226, 183);">.</span>Length <span style="color: rgb(232, 226, 183);">></span> <span style="color: rgb(255, 205, 34);">0</span> <span style="color: rgb(232, 226, 183);">&&</span> imgStream<span style="color: rgb(232, 226, 183);">.</span>Length <span style="color: rgb(232, 226, 183);">></span> outStrm<span style="color: rgb(232, 226, 183);">.</span>Length)
{
pg<span style="color: rgb(232, 226, 183);">.</span>Resources<span style="color: rgb(232, 226, 183);">.</span>Images<span style="color: rgb(232, 226, 183);">.</span>Replace(i, outStrm);
outStrm<span style="color: rgb(232, 226, 183);">.</span>Flush();
outStrm<span style="color: rgb(232, 226, 183);">.</span>Close();
}
}
}
}
}
doc<span style="color: rgb(232, 226, 183);">.</span>Pages<span style="color: rgb(232, 226, 183);">.</span>Flatten();
<span style="color: rgb(103, 140, 177);">Console</span><span style="color: rgb(232, 226, 183);">.</span>WriteLine(<span style="color: rgb(103, 140, 177);">String</span><span style="color: rgb(232, 226, 183);">.</span>Format(<span style="color: rgb(236, 118, 0);">"Saving!! {0} /r/n"</span>, srcDoc));
doc<span style="color: rgb(232, 226, 183);">.</span>Save(destDoc);
}
<span style="color: rgb(147, 199, 99);">public</span> <span style="color: rgb(147, 199, 99);">static</span> <span style="color: rgb(147, 199, 99);">byte</span>[] SetJPEGCompression(<span style="color: rgb(147, 199, 99);">byte</span>[] srcBytes, <span style="color: rgb(147, 199, 99);">long</span> compressionLevel)
{
<span style="color: rgb(103, 140, 177);">ImageConverter</span> ic <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">ImageConverter</span>();
<span style="color: rgb(103, 140, 177);">Image</span> image <span style="color: rgb(232, 226, 183);">=</span> (<span style="color: rgb(103, 140, 177);">Image</span>)ic<span style="color: rgb(232, 226, 183);">.</span>ConvertFrom(srcBytes);
<span style="color: rgb(147, 199, 99);">if</span> (image<span style="color: rgb(232, 226, 183);">.</span>RawFormat<span style="color: rgb(232, 226, 183);">.</span>Guid <span style="color: rgb(232, 226, 183);">==</span> System<span style="color: rgb(232, 226, 183);">.</span>Drawing<span style="color: rgb(232, 226, 183);">.</span>Imaging<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">ImageFormat</span><span style="color: rgb(232, 226, 183);">.</span>Jpeg<span style="color: rgb(232, 226, 183);">.</span>Guid)
{
<span style="color: rgb(147, 199, 99);">if</span> (compressionLevel <span style="color: rgb(232, 226, 183);"><</span> <span style="color: rgb(255, 205, 34);">0</span>)
{
compressionLevel <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">0</span>;
}
<span style="color: rgb(147, 199, 99);">else</span> <span style="color: rgb(147, 199, 99);">if</span> (compressionLevel <span style="color: rgb(232, 226, 183);">></span> <span style="color: rgb(255, 205, 34);">100</span>)
{
compressionLevel <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(255, 205, 34);">100</span>;
}
<span style="color: rgb(103, 140, 177);">ImageCodecInfo</span> jgpEncoder <span style="color: rgb(232, 226, 183);">=</span> GetEncoder(<span style="color: rgb(103, 140, 177);">ImageFormat</span><span style="color: rgb(232, 226, 183);">.</span>Jpeg);
System<span style="color: rgb(232, 226, 183);">.</span>Drawing<span style="color: rgb(232, 226, 183);">.</span>Imaging<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Encoder</span> myEncoder <span style="color: rgb(232, 226, 183);">=</span> System<span style="color: rgb(232, 226, 183);">.</span>Drawing<span style="color: rgb(232, 226, 183);">.</span>Imaging<span style="color: rgb(232, 226, 183);">.</span><span style="color: rgb(103, 140, 177);">Encoder</span><span style="color: rgb(232, 226, 183);">.</span>Quality;
<span style="color: rgb(103, 140, 177);">EncoderParameters</span> myEncoderParameters <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">EncoderParameters</span>(<span style="color: rgb(255, 205, 34);">1</span>);
<span style="color: rgb(103, 140, 177);">EncoderParameter</span> myEncoderParameter <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">EncoderParameter</span>(myEncoder, compressionLevel);
myEncoderParameters<span style="color: rgb(232, 226, 183);">.</span>Param[<span style="color: rgb(255, 205, 34);">0</span>] <span style="color: rgb(232, 226, 183);">=</span> myEncoderParameter;
<span style="color: rgb(147, 199, 99);">using</span> (<span style="color: rgb(103, 140, 177);">MemoryStream</span> ms <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(147, 199, 99);">new</span> <span style="color: rgb(103, 140, 177);">MemoryStream</span>())
{
image<span style="color: rgb(232, 226, 183);">.</span>Save(ms, jgpEncoder, myEncoderParameters);
<span style="color: rgb(147, 199, 99);">return</span> ms<span style="color: rgb(232, 226, 183);">.</span>ToArray();
}
}
<span style="color: rgb(147, 199, 99);">else</span>
{
<span style="color: rgb(147, 199, 99);">return</span> srcBytes;
}
}
<span style="color: rgb(147, 199, 99);">public</span> <span style="color: rgb(147, 199, 99);">static</span> <span style="color: rgb(103, 140, 177);">ImageCodecInfo</span> GetEncoder(<span style="color: rgb(103, 140, 177);">ImageFormat</span> format)
{
<span style="color: rgb(103, 140, 177);">ImageCodecInfo</span>[] codecs <span style="color: rgb(232, 226, 183);">=</span> <span style="color: rgb(103, 140, 177);">ImageCodecInfo</span><span style="color: rgb(232, 226, 183);">.</span>GetImageDecoders();
<span style="color: rgb(147, 199, 99);">foreach</span> (<span style="color: rgb(103, 140, 177);">ImageCodecInfo</span> codec <span style="color: rgb(147, 199, 99);">in</span> codecs)
{
<span style="color: rgb(147, 199, 99);">if</span> (codec<span style="color: rgb(232, 226, 183);">.</span>FormatID <span style="color: rgb(232, 226, 183);">==</span> format<span style="color: rgb(232, 226, 183);">.</span>Guid)
{
<span style="color: rgb(147, 199, 99);">return</span> codec;
}
}
<span style="color: rgb(147, 199, 99);">return</span> <span style="color: rgb(147, 199, 99);">null</span>;
}
I am essentially resampling the JPEGs in the file and setting their quality lower. When I do this, some images in the file get corrupted.
Also, is there a way to tell what the underlying image type is of a resource. I have heard that PDF images are either native bitmaps, or JPEG images.
Thanks,
Sean