CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2011
    Posts
    63

    Improving quality of image

    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"?

  2. #2
    Join Date
    Apr 2010
    Posts
    131

    Re: Improving quality of image

    Can you source the image in vector format? First question/best solution for export to PDF.

  3. #3
    Join Date
    Nov 2011
    Posts
    63

    Re: Improving quality of image

    No, but we solved half the problem by doing this:

    PdfExport.ImageQuality = ImageQuality.Highest;

  4. #4
    Join Date
    Jul 2012
    Posts
    90

    Re: Improving quality of image

    Have you tried setting graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic?

  5. #5
    Join Date
    Sep 2012
    Posts
    2

    Re: Improving quality of image

    PDF has a mode for "lossless image compression", using, I think, ZIP compression. You might want to try that mode...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured