We help IT Professionals succeed at work.
Get Started

Dithered Gif images created by .Net

Last Modified: 2013-12-16
I am dynamically creating images in .Net 3.0, but each format is giving me problems.
- When I save as Gif, the image is (I think the term is) 'ditherered'
- When I save as Png, it looks great in Firefox but in IE7 the colours ae not correct (for example in IE7 renders #CD5C5C as #C75151 - compare attached file in FF and IE).

So I either need the gif to be non-dithered, or the Png to work in IE - ideally a solution for both would be great.
// Creates a square with a circle in the middle.
Bitmap tn = new Bitmap(30, 30);
Graphics gForm = Graphics.FromImage(tn);
gForm.CompositingMode = CompositingMode.SourceOver;
gForm.CompositingQuality = CompositingQuality.HighQuality;
gForm.SmoothingMode = SmoothingMode.HighQuality; ;
// Draw the background.
Brush BackBrush = new SolidBrush(Color.IndianRed);
gForm.FillRectangle(BackBrush, 0, 0, tn.Height, tn.Width);
Brush FillBrush = new SolidBrush(Color.BlueViolet);
gForm.FillEllipse(FillBrush, 10, 10, 10, 10);
tn.Save(OutputFolder + @"test.jpg", ImageFormat.Jpeg); //too blury!
tn.Save(OutputFolder + @"test.Gif", ImageFormat.Gif); // too dithered!
tn.Save(OutputFolder + @"test.Png", ImageFormat.Png); // IE7 problem!

Open in new window

Watch Question
Software Architect
Top Expert 2008
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE