getting tiff image dimension
-
hi I'm trying to programmaticaly get a scanned tiff image's dimension like the info displayed in summary tab of properties dialog of file is there any way to get dimension directly instead of using resolution? any idea?
I Wish the Life Had CTRL-Z
If you can work out what the shell is doing to get that info, you can try to p/invoke it.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
hi I'm trying to programmaticaly get a scanned tiff image's dimension like the info displayed in summary tab of properties dialog of file is there any way to get dimension directly instead of using resolution? any idea?
I Wish the Life Had CTRL-Z
If by "dimension" you mean the width and height of the image measured in pixels, which is what I see in the summary tab, you can use this quick and dirty means.
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap("MyImage.tif");
int width = bitmap.Width;
int height = bitmap.Height;
bitmap.Dispose();If you need more info, you could get a copy of the TIFF specification, read the file header, and extract what you need from those bytes. Hope that helps.
BDF A learned fool is more a fool than an ignorant fool. -- Moliere
-
If by "dimension" you mean the width and height of the image measured in pixels, which is what I see in the summary tab, you can use this quick and dirty means.
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap("MyImage.tif");
int width = bitmap.Width;
int height = bitmap.Height;
bitmap.Dispose();If you need more info, you could get a copy of the TIFF specification, read the file header, and extract what you need from those bytes. Hope that helps.
BDF A learned fool is more a fool than an ignorant fool. -- Moliere
-
If you can work out what the shell is doing to get that info, you can try to p/invoke it.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )