|
|
You can try encode such images yourself and write raw bytes into the image object stream.
Also you may try to create PdfBitmap with appropriate pixel format.
|
|
|
Thanks, loading jpeg works.
It decodes Jpeg image by DCTDecode. Jpeg has sense only for images in color. 8bpp (grayscale) and 1bpp (black white) can't be used in jpeg. Is there any other way to optimize the size of PDF?
|
|
|
PdfBitmap is by definition an uncompressed image. Compression mode should be applied to the PdfImageObject, that is placed in the content stream on a page.
When the PdfBitmap inserted into PdfImageObject the FlateDecode is used to compress this image. This is by default behavior.
You may try PdfImageObject.LoadJpegFile(). In this case JPXDecode will be applied.
Also you may try to create monochrome bitmap instead of argb format.
|
|
|
Hello, how can I specify filter for image: DCTDecode, JBIG2Decode, JPXDecode, FlateDecode... I need to optimize size of pdf which contains only one image per page and trying to use jpeg format, but I do not know how. I'm using following code to create PdfBitmap: Code:PdfBitmap result = null;
BitmapFormats pdfFormat;
int[] palette;
GetPdfFormat(bitmap, out pdfFormat, out palette);
var lockInfo = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
result = new PdfBitmap(bitmap.Width, bitmap.Height, pdfFormat, lockInfo.Scan0, lockInfo.Stride);
bitmap.UnlockBits(lockInfo);
if (palette != null)
{
result.Palette = palette;
}
Thank you.
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close