Pixel behaviour of FillRectangle and DrawRectangle

These methods work correctly, you just have to take into account effects of anti-aliasing and rounding. First, turn on anti-aliasing to see everything (not only rounded result): graphics.SmoothingMode = SmoothingMode.AntiAlias; Now FillRectangle(10,10,10,10) will produce blurry result and DrawRectangle(10,10,10,10) will be sharp. The blurry result means that you have pixel coordinates off-grid. If you need to … Read more

GDI+ / C#: How to save an image as EMF?

Image is an abstract class: what you want to do depends on whether you are dealing with a Metafile or a Bitmap. Creating an image with GDI+ and saving it as an EMF is simple with Metafile. Per Mike’s post: var path = @”c:\foo.emf” var g = CreateGraphics(); // get a graphics object from your … Read more

JPEG 2000 support in C#.NET

Seems like we can do it using FreeImage (which is free) FIBITMAP dib = FreeImage.LoadEx(“test.jp2”); //save the image out to disk FreeImage.Save(FREE_IMAGE_FORMAT.FIF_JPEG, dib, “test.jpg”, FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYNORMAL); //or even turn it into a normal Bitmap for later use Bitmap bitmap = FreeImage.GetBitmap(dib);