C#转换为位图索引颜色格式

编程入门 行业动态 更新时间:2024-10-26 18:24:32
本文介绍了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.

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

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

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

For best quality use "Octree-based Quantization".

更多推荐

C#转换为位图索引颜色格式

本文发布于:2023-10-23 18:47:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521705.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位图   转换为   索引   颜色   格式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!