如何在转换为stdole.IPictureDisp之前将图像的背景颜色更改为白色。 [英] how to change the backcolor of an image to white before contverting to stdole.IPictureDisp .

查看:58
本文介绍了如何在转换为stdole.IPictureDisp之前将图像的背景颜色更改为白色。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图像的路径,并使用GetIPictureDispFromPicture(Image)将其转换为stdole.IPictureDisp;函数。



在转换之前我使用了bitmap.MakeTransparent(Color.White);

但它没有用,图像的背景颜色是不是白色。



I have path of an image and convert it to stdole.IPictureDisp using GetIPictureDispFromPicture( Image ); function.

Before converting i used bitmap.MakeTransparent(Color.White);
But it did not work, the backcolor of image is not white.

stdole.IPictureDisp img = null;
Bitmap bmp1 = new Bitmap(Image.FromFile(this.signTxtBx.Text));
                        TransparencyKey = Color.White;
                        bmp1.MakeTransparent();
img = ( stdole.IPictureDisp ) GetIPictureDispFromPicture( Image );





有没有其他方法可以将backcolor更改为white 。



Is there any other way to change to backcolor to white.

推荐答案

Bitmap没有这样的属性'background'。

每个像素的颜色可以用以下两种方式之一设置: />
1.指向颜色调色板的'指针',位于位图标题中

2.直接颜色值(如果是高分辨率图像)



要更改图像中的颜色,首先您必须知道要更改的颜色以及当前图像使用的颜色模型...

如果您很幸运,这是一个索引图像,你只需要替换调色板中的右边条目,如果图像基于直接颜色值,你必须逐个像素地运行和改变...



更多。考虑一下,在从真实摄影中拍摄的图像中,您看到的白色可以由多种阴影组成,因此即使选择单一颜色并替换它也不会起作用......
Bitmap has no such property 'background'.
Color of each pixel can be set in one of two ways:
1. A 'pointer' to a color-palette, located in the Bitmap header
2. A direct color value (in case of hi-resolution image)

To change a color in the image you first you have to know what color to change and what color model the current image uses...
If you are lucky and this is an indexed image, you only have to replace the right entry in the color palette, if the image based on direct color values, you have to run and change pixel by pixel...

More. Consider, that in an image taken from real photography, what you see as white can be made of several shades, so even picking a single color and replacing it will not do the job...


这篇关于如何在转换为stdole.IPictureDisp之前将图像的背景颜色更改为白色。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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