Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image quality needs improvement

Status
Not open for further replies.

gib99

Programmer
Mar 23, 2012
51
0
0
CA
Hello,

I have an image that I would like to make more "crisp".

The code (in C#) for producing the image looks like this:

Code:
            Bitmap bitmap = new Bitmap(rectangle.Width, rectangle.Height, PixelFormat.Format24bppRgb);
            Graphics graphics = Graphics.FromImage(bitmap);
            graphics.Clear(Color.White);
            BowTieController controller = new BowTieController(_session, loop, new PointF(1.0F, 1.0F));
            controller.Draw(graphics, rectangle);

What a BowTieController is may or may not be important right now, but I'd like to focus first on how the Bitmap and Graphics objects are

initialized, and if the problem turns out not to be there, we can then focus on the BowTieController and how it draws the image.

First, let me explain where the problem shows up. After the above code draws the image, it is then placed into a Picture control in ActiveReports. It is then exported to PDF. You really notice the poor quality of the image in PDF. Something like the resolution or anti-aliasing needs to be improved.

I tried things like the following to no avail:

bitmap.SetResolution(bitmap.HorizontalResolution * 2, bitmap.VerticalResolution * 2);

graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

Is there anything else I can try on the Bitmap or Graphics objects that might make the image appear more "crip"?
 
Do youy have the ability to set the dpi in the pdf? Monitor resolution is 72dpi. Standard printing is over 200dpi (usually 300). If it looks okay on the screen, but not on the print out, that's probably your issue.

Just doubling the resolution of an image is not going to make it better. You need appropriately sized source images, or you will get some blurring when you upsize them.

Lodlaiden

You've got questions and source code. We want both!
Here at tek tips, we provide a hand up, not a hand out.
 
No, that didn't help, but I found that adding this lines solves half the problem:

PdfExport.ImageQuality = ImageQuality.Highest;
 
Have you saved the image out on it's own to validate that it is fine before pdf compositing?

You've got questions and source code. We want both!
Here at tek tips, we provide a hand up, not a hand out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top