开发者

Visual Basic.net RGB, Transparency and locate pixel

I am making an image modifying program and would like to know how (after I have located the .png, .gif, .bmp etc) I can identify the properties of a certain pixel (RGB and the amount of transparency), how to change the colour of a pixel (similar to first part) and how to tell the program to "move along to the next pixel, unless you are at the end of the image, in which case; move down a row and continue" please help.

开发者_开发百科

Also, it is a program which converts a greyscale image (black, white and grey) to black, semi-transparent black and transparency). Just in case that helps. Thanks a lot to whoever can give me the code, US3R5


You should create a Bitmap object from your file, for example using:

var path = "Path to your image";
var bitmap = new Bitmap(new Image(path));

Then you can iterate over the pixels like this:

for(int i = 0; i < bitmap.Width; i++)
  for(int j = 0; j < bitmap.Height; j++)
  {
    var pixel = bitmap.GetPixel(i,j);
    bitmap.SetPixel(i,j,SomeTransformation(pixel));
  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜