PC Review


Reply
Thread Tools Rate Thread

Compressing image colors:

 
 
Fergus Cooney
Guest
Posts: n/a
 
      3rd Oct 2003
Hi MC D,

Strange things happen. Only today I was browsing on a totally different
question and came across this

Color Quantization and GDI+ GIF with much better quality
This sample shows how to decrease colors in an image from 24bit to 8 bit. And
various other numbers of colors as well, from 8 to 256. Quantization is done
by using an octree. Many thanks to vbaccelerator.com.

GDI+ uses a halftone palette by default to save the image to file. This leads
to terrible quality in many cases. This sample greatly improves the saved GIF
image. Enjoy!

http://www.dotnetforums.net/t74693.html


Regards,
Fergus


 
Reply With Quote
 
 
 
 
MC D
Guest
Posts: n/a
 
      3rd Oct 2003
I have a aspx page that outputs an image to the response.outputstream. This
works great. However, I want to be able to make the image it outputs a .gif
file. I can change the output type to "image/gif" and save the image by
doing:

myBitmap.Save(response.outputstream,ImageFormat.Gif)
and this works, BUT it uses a horrible halftone palette to reduce the
colors. I have been trying for a day and a half to figure out any way to
reduce the colors into a .gif with no success. You can see the articles at:
http://support.microsoft.com/default...;EN-US;Q319591 and
http://support.microsoft.com/default...;EN-US;Q319061 which
actually work, but only in grayscale. Does anyone have any ideas of a way to
do this?

OR

I have also tried outputting the file as a PNG, which works, but because
(for whatever reason), the png always comes out darker than the original,
and I need the background color of my image to match the background color on
the site. SOOOooo... If someone can tell me how to make a background color
of a png transparent, programmatically, that might work too.

Thanks for any help!!!


 
Reply With Quote
 
MC D
Guest
Posts: n/a
 
      4th Oct 2003
Thanks! I'll give it a look!

-D

"Fergus Cooney" <filter-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi MC D,
>
> Strange things happen. Only today I was browsing on a totally

different
> question and came across this
>
> Color Quantization and GDI+ GIF with much better quality
> This sample shows how to decrease colors in an image from 24bit to 8 bit.

And
> various other numbers of colors as well, from 8 to 256. Quantization is

done
> by using an octree. Many thanks to vbaccelerator.com.
>
> GDI+ uses a halftone palette by default to save the image to file. This

leads
> to terrible quality in many cases. This sample greatly improves the saved

GIF
> image. Enjoy!
>
> http://www.dotnetforums.net/t74693.html
>
>
> Regards,
> Fergus
>
>



 
Reply With Quote
 
Glenn Randers-Pehrson
Guest
Posts: n/a
 
      4th Oct 2003
"MC D" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> I have a aspx page that outputs an image to the response.outputstream. This
> works great. However, I want to be able to make the image it outputs a .gif
> file. I can change the output type to "image/gif" and save the image by
> doing:
>
> myBitmap.Save(response.outputstream,ImageFormat.Gif)
> and this works, BUT it uses a horrible halftone palette to reduce the
> colors. I have been trying for a day and a half to figure out any way to
> reduce the colors into a .gif with no success. You can see the articles at:
> http://support.microsoft.com/default...;EN-US;Q319591 and
> http://support.microsoft.com/default...;EN-US;Q319061 which
> actually work, but only in grayscale. Does anyone have any ideas of a way to
> do this?
>
> OR
>
> I have also tried outputting the file as a PNG, which works, but because
> (for whatever reason), the png always comes out darker than the original,
> and I need the background color of my image to match the background color on
> the site. SOOOooo... If someone can tell me how to make a background color
> of a png transparent, programmatically, that might work too.
>
> Thanks for any help!!!


If you are using MSIE to view the images, they appear darker because
MSIE mishandles the gamma data. Try removing the gAMA chunk and
using only the sRGB chunk, and see if the color level is better.
You can use the pngcrush application from an MSDOS window to do this.

pngcrush -rem gama -srgb 1 in.png temp.png

Get pngcrush from the DOWNLOAD link at http://pmt.sf.net/pngcrush

Glenn
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compressing cropped image =?Utf-8?B?Y29sb3JhZGlv?= Microsoft Word Document Management 2 25th Sep 2007 08:16 PM
compressing cropped image =?Utf-8?B?Y29sb3JhZGlv?= Microsoft Word Document Management 0 25th Sep 2007 06:12 PM
convert a 24bit colors .BMP image in a 8bit colors BMP =?Utf-8?B?RmlsaXBwbyBCZXR0aW5hZ2xpbw==?= Microsoft Dot NET 1 9th Mar 2006 12:58 PM
compressing image files =?Utf-8?B?R2lybHB3cg==?= Microsoft Powerpoint 10 27th Jul 2005 11:05 PM
Compressing image colors: Fergus Cooney Microsoft C# .NET 3 4th Oct 2003 01:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:33 PM.