将24位的彩色图片转化为8位的灰度图片 C#写的。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Diagnostics;
namespace my24to8
{
public partial class Form1 : Form
{
Bitmap curBitmap;
Bitmap bit;
Stopwatch st;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog op = new OpenFileDialog();
if (op.ShowDialog() == DialogResult.OK)
{
curBitmap = (Bitmap)Bitmap.FromFile(op.FileName);
pictureBox1.Image = curBitmap

本文介绍了一个使用C#实现的将24位彩色图片转换为8位灰度图片的方法。该过程涉及读取原始图片的像素数据、计算灰度值并应用到新的8位灰度图片中,最终保存转换后的图片。
最低0.47元/天 解锁文章
1152

被折叠的 条评论
为什么被折叠?



