Hi,
1. loaded the jpg to picture box (in Size mode as Zoomed).
2. I drawn a rectangle on the picture box and taken the coordinate.
3. opens the jpg in paint and observed the coordinate (where i drawn rectangle on the picture box). when i compare the rectangle coordinate(x and y) with paint coordinate it not the same.
I changed the Size mode to normal and observed that the coordinates are same but the Image size is too large so it display partially. so use zoom size mode property.
Say image with size 2825x3538 and keep the picture box size mode as Normal, the image shows partially in picture box. So i changed picture box mode to zoom (to fit the System screen resolution). and coordinate miss matched when compare it with Normal mode with zoom mode.
How can i achieve the same coordinates.
Loading
Nivas SadashivamPosted Dec 10, 2010, 3:05 AM
i like to extract text from an image (size 2825, 3538). for that i have load image in a picture box and called in bitmap (size 1142, 744) and drawn a rectangle (some where on the image). my aim is to extract the text from the drawn area. if i compare the drawn rectangle coordinates with original image size, it's get varies. what will be the scale factor to get the drawn rectangle matches with original image areas.
Pls guide me on this....It's important to my project
FroglegPosted Dec 10, 2010, 1:13 AM
Bitmap myBitmap;
private void button1_Click(object sender, EventArgs e)
{
myBitmap = new Bitmap(2825, 3538);
Image myImage = Image.FromFile("big.jpg");
Graphics g = Graphics.FromImage(myBitmap);
g.DrawImage(myImage, 0, 0);//draw jpg to in memory bitmap
g.DrawRectangle(Pens.Red, 20, 20, 2785, 3498);//draw rectangle
myBitmap.Save("whatever.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
Make picturebox 10% size of bitmap with sizemode set to stretch image (autosize will make picturebox same size as image)
Draw to the smaller image at the same time transferring dimensions to larger image x 10 - or use larger image with scrollbars