PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Adding a bmp image into migradoc document causes blurriness
https://forum.pdfsharp.net/viewtopic.php?f=2&t=922
Page 1 of 1

Author:  Michael Arden [ Mon Nov 02, 2009 1:46 am ]
Post subject:  Adding a bmp image into migradoc document causes blurriness

I have a custom bar code generator which produces a bmp imagefile. When adding this into Migradoc (using Paragraph.Add(Image), the result is that the bars become blurred. What causes this? Rendering? Ratios of initial vs. final resolutions? ... How can I avoid this? I.e., can I force Migradoc to allow a specified size for an image it is adding (if that is what is causing it).

I've added screen shots of the original image and the resulting Migradoc file.

Thanks.

Attachments:
Initial image file.PNG
Initial image file.PNG [ 7.82 KiB | Viewed 12408 times ]
After added into Migradoc document.JPG
After added into Migradoc document.JPG [ 27.49 KiB | Viewed 12408 times ]

Author:  Thomas Hoevel [ Mon Nov 02, 2009 9:41 am ]
Post subject:  Re: Adding a bmp image into migradoc document causes blurriness

Adobe Reader causes this blurriness.
You can turn it off in the display options of your Reader (but on other computers it will be on by default). AFAIK this cannot be turned of using options in the PDF file.

Author:  Pete [ Mon Nov 16, 2009 5:16 pm ]
Post subject:  Re: Adding a bmp image into migradoc document causes blurriness

The same thing happens in rtf documents using MigraDoc - is this a bug?

If not, what's missing from code to prevent this happening?

Author:  Thomas Hoevel [ Tue Nov 17, 2009 9:59 am ]
Post subject:  Re: Adding a bmp image into migradoc document causes blurriness

Pete wrote:
The same thing happens in rtf documents using MigraDoc - is this a bug?
If not, what's missing from code to prevent this happening?


It's not a bug, it's a feature. A feature of the program that displays the documents.

In Adobe Reader, the "Blurriness" feature is called "Smoothing".
Go to "Preferences", then "Page Display"; in the "Rendering" group box, disable "Smooth line art" and "Smooth images" to avoid blurriness.
Adobe Reader will still smooth some images ...

And AFAIK it's not possible to override these user-preferences with document options.

It seems that Word will always smooth the images. So when viewing RTF with Word, there is no way I know to avoid blurriness.

Author:  Thomas Hoevel [ Wed Nov 18, 2009 1:33 pm ]
Post subject:  Re: Adding a bmp image into migradoc document causes blurriness

The PDF file can contain a hint to the display program indicating whether interpolation of image data is requested.

You can say no in your code:
Code:
XImage image = XImage.FromFile(file);
image.Interpolate = false;


It's a hint, so it may not always prevent blurriness.

Author:  mikesowerbutts [ Mon Nov 23, 2009 10:49 am ]
Post subject:  Re: Adding a bmp image into migradoc document causes blurriness

Hi,

I have noticed that when using bitmap images, they seem to display at roughly twice the size when viewed at 100% in acrobat reader than they do when viewed at 100% in photoshop, is this becuase of the difference in the DPI of the PDF? its not a big problem, but if I knew why it happens, then I could make my images "correctly" first time, rather than creating them, realising they are too big and then re-sizing them.

mike

Author:  Thomas Hoevel [ Mon Nov 23, 2009 12:12 pm ]
Post subject:  Re: Adding a bmp image into migradoc document causes blurriness

mikesowerbutts wrote:
I have noticed that when using bitmap images, they seem to display at roughly twice the size when viewed at 100% in acrobat reader than they do when viewed at 100% in photoshop, is this becuase of the difference in the DPI of the PDF?

PhotoShop is pixel-based: 100% in PhotoShop means every pixel of the picture will have exactly one pixel on the display.

PDF is vector-based: 100% in Adobe Reader means the page on screen has the same size as the page on paper (Windows knows the physical size of your monitor).

If you specify width and height in MigraDoc, these values will be used; otherwise width and height as specified in PhotoShop will be used.
An image that is 300 pixels wide can be set to 1 cm, 1 inch, 5 cm, or anything else in PhotoShop.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/