Nikhil D
Nikhil D

Reputation: 2509

show pixel value of .TIF image on the basis of X Y coordinates in c#

i am in trouble. how to read 1MB .tif file with bitmap class in c# and have to show pixel value of this .tif image on the basis of X Y coordinates. I searched google lot but not find any answer yet.

string imgPath;
            imgPath = @"C:\Documents and Settings\shree\Desktop\2012.06.09.15.35.42.2320.tif";


            Bitmap img;
            img = new Bitmap(imgPath, true);

            MessageBox.Show(Here i have to show pixel value of this .tif image on the basis of X Y coordinates.);

Upvotes: 0

Views: 1293

Answers (1)

yogi
yogi

Reputation: 19591

Try this

string imgPath;
imgPath = @"C:\Documents and Settings\shree\Desktop\2012.06.09.15.35.42.2320.tif";

Bitmap img;
img = new Bitmap(imgPath, true);

Color pixelColor = img.GetPixel(50, 50); // 50, 50 or any "VALID" pixel in your bitmap

For more info go here

Upvotes: 2

Related Questions