heathen world
heathen world

Reputation: 150

Why would the output image from this code be darker than the original?

I'm a newbie to working with images in NET. My goal is to add text and an icon to the starting image, then save the output.

The result comes out a bit darker. Starting with a solid image (png-24) #788eb3 comes out #6d84ab. Tested to insure background/transparency is not the issue.

I removed everything except the code to get the image, then save it, and the result is still darker. What direction should I go to make this work better?

System.Drawing.Image img = Bitmap.FromFile(@"c:\\oldfile.png", true);
img.Save(@"c:\\newfile.png", ImageFormat.Png);

Upvotes: 1

Views: 446

Answers (2)

heathen world
heathen world

Reputation: 150

The real issue turned out to be the browser! IE7 and IE8 render #788eb3 in a png differently than the same color as a css background color. IE9, Chrome and Firefox all look good.

Upvotes: 1

Jonathan Henson
Jonathan Henson

Reputation: 8206

My guess is that you have the color correction turned on. Try passing false instead of true to Bitmap.FromFile.

Upvotes: 0

Related Questions