C#转换为位图索引颜色格式 [英] C# Convert Bitmap to indexed colour format

查看:239
本文介绍了C#转换为位图索引颜色格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能一个24位彩色 System.Drawing.Bitmap 转换为一个索引(256色)格式?我有麻烦工作如何计算调色板。我可以遍历像素,并使用 INT [] 包含各种颜色,但是当有超过256种颜色的问题就来了。有没有一种方法来转换为索引的格式,并从提取256色调色板的位图

How can I convert a 24-bit colour System.Drawing.Bitmap to an indexed (256-colour) format? I'm having trouble working out how to calculate the palette. I can iterate over the pixels and use an int[] to contain the various colours but the problem comes when there are more than 256 colours. Is there a way to convert to an indexed format and extract a 256-colour palette from an Bitmap ?

推荐答案

我有同样的挑战更早。这是可能的。NET中使用GDI +来解决。

I had the same challenge earlier. It's possible to solve using GDI+ in .Net.

这篇文章对我帮助很大(均含标本): http://msdn.microsoft .COM / EN-US /库/ Aa479306

This article helped me a lot (including samples): http://msdn.microsoft.com/en-us/library/Aa479306

有关质量最好使用八叉树为基础的量化。

For best quality use "Octree-based Quantization".

这篇关于C#转换为位图索引颜色格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆