Multimobile Development: Building Applications for any Smartphone
Color Depth
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.drawing.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Chuck Douglas
GOOD ANSWER
What is the difference between PixelFormat and Encoder.ColorDepth? If I
create a bitmap with a PixelFormat of Format24bppRgb, how can I save this
bitmap as an 8 bpp image. I have tried using an EncoderParameter. I set
the Encoder.ColorDepth parameter to 8 and whenever I save the image it seems
to write out a 24 bpp image. Any ideas?

Thanks
Chuck

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
John Hornick [MS] (VIP)
GOOD ANSWER
Hi,

[Original message clipped]

PixelFormat is the actual format of the image in memory. If you have an
image which has a PixelFormat of 24bpp, and you wish to save it as an
8bpp image, then a reduction in color depth must occur. If the codec
supports it, you could request this color depth via an EncoderParameter.
However, I can tell you that the only codec which will support this
reduction (any reduction to an indexed format) is the GIF Encoder.

You will need to first reduce the image to 8bpp yourself, then ask
the codec to encode it for you at the new "native" color depth. There
is no help for you in the framework for performing the reduction - you'll
simply need to do it yourself.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
 
System.Drawing.Imaging.EncoderParameter
System.Drawing.Imaging.PixelFormat
System.Text.Encoder




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734