I want to make a small 'front end' application which makes it possible for the user to save pictures (TIFF) in the database. Idea is to let the user open a file and have the content shown in the dialog. These files may be result from scanning and an application which later will present the TIFF pictures from the database, expects that the size of the picture is be stored in the database. Resolution in the database is set to 1/10mm.
How is it possible for me to find out the actual size of the picture. Assume that the picture is standard A4 (approx 21 x 29 cm). I know that the wxImage class have methods to retreive the width and height, however these are given in pixels, which I assume is the number of pixels as from the scanner (in the file). I seen that the GDI+ library (Microsoft) Image class have the methods "GetVerticalResolution" and "GetHorizontalResolution", and I suspect that I could use these together with the pix-width and pix-height to find out the actual size of the picture and then store this in the database.
Is there any similar method in the wxImage - or how should I accomplish this.
Thanks for any help.
Nikolai
Nikolai Kirsebom wrote:
How is it possible for me to find out the actual size of the picture. Assume that the picture is standard A4 (approx 21 x 29 cm). I know that the wxImage class have methods to retreive the width and height, however these are given in pixels, which I assume is the number of pixels as from the scanner (in the file).
Unfortunately, there really isn't any way to do this. Physical size data is not stored in the file, AFAIK. The "Get***Resolution" methods that you mention are just an approximation, and are likely only applicable for video displays, but they can't possibly return an accurate value even there. (Consider that Windows doesn't know whether your 800x600 display is on a 15" monitor or a 17" monitor -- each pixel will be of a different physical width depending on the monitor size).
Your only hope is if you can establish somehow, what resolution the scanner was set at when it scanned the image in. If you can ensure that all images are scanned at 300dpi, say, then you can divide the number of pixels by 300.0 and you'll have inches. (You can then convert to whatever measure you want, of course.) However, there's no way to discover the scanning resolution, programmatically -- you have to have outside information for that. Depending on your control over the scanning environment, you can either declare a specific resolution to always be used, or enforce a naming convention on the
TIFF files that encodes the resolution. If you don't have that much control, then you're out of luck.
Jeff Shannon
Technician/Programmer
Credit International
I want to make a small 'front end' application which makes it possible for
the user to save pictures (TIFF) in the database. Idea is to let the user
open a file and have the content shown in the dialog. These files may be
result from scanning and an application which later will present the TIFF
pictures from the database, expects that the size of the picture is be
stored in the database. Resolution in the database is set to 1/10mm.
How is it possible for me to find out the actual size of the picture.
Assume that the picture is standard A4 (approx 21 x 29 cm). I know that
the wxImage class have methods to retreive the width and height, however
these are given in pixels, which I assume is the number of pixels as from
the scanner (in the file). I seen that the GDI+ library (Microsoft) Image
class have the methods "GetVerticalResolution" and
"GetHorizontalResolution", and I suspect that I could use these together
with the pix-width and pix-height to find out the actual size of the
picture and then store this in the database.
Is there any similar method in the wxImage - or how should I accomplish
this.
Don't know, but did you considered tiffinfo?
Thanks for any help.
Nikolai
Cheers,
Hans-Peter
ยทยทยท
On Thursday, 11. April 2002 00:40, Nikolai Kirsebom wrote: