Views
675
Replies
6
Status
Closed
What I do:-
I am writing an image to a file as a Windows bitmap from a program I wrote. I want to set the resolution in the file header to 300ppi. Now, in the header the resolution in specified in pixels per metre [1], so I calculate 300ppi=11811px/m (multiply by 39.37 in/m [2]). I then convert this to \x23\x2E\x00\x00 (Intel format dword) and write it in the header (both x- and y-resolutions)
What goes wrong:-
So far, so good. BUT when the file is opened in Photoshop 6.0.1 the resolution is reported as 300.125ppi. If I change the resolution in Photoshop to exactly 300ppi then the data in the file is \x20\x2E\x00\x00, which is 11808px/m (=299.924ppi in reality).
Same problem at 72ppi: the maths says \x13\x0B\x00\x00 but PS writes \x12\x0B\x00\x00
If I pretend that there are 39.36 in/m then 300ppi converts to what PS claims, but 72ppi does not.
Question:-
Is there some convention regarding resolution settings whereby a fiddle-factor is used?
Andrew
[1]: BITMAPHEADERINFO
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/gdi/bitmaps_1rw2.asp
[2]: NIST Guide to SI Units
http://physics.nist.gov/Pubs/SP811/appenB.html
I am writing an image to a file as a Windows bitmap from a program I wrote. I want to set the resolution in the file header to 300ppi. Now, in the header the resolution in specified in pixels per metre [1], so I calculate 300ppi=11811px/m (multiply by 39.37 in/m [2]). I then convert this to \x23\x2E\x00\x00 (Intel format dword) and write it in the header (both x- and y-resolutions)
What goes wrong:-
So far, so good. BUT when the file is opened in Photoshop 6.0.1 the resolution is reported as 300.125ppi. If I change the resolution in Photoshop to exactly 300ppi then the data in the file is \x20\x2E\x00\x00, which is 11808px/m (=299.924ppi in reality).
Same problem at 72ppi: the maths says \x13\x0B\x00\x00 but PS writes \x12\x0B\x00\x00
If I pretend that there are 39.36 in/m then 300ppi converts to what PS claims, but 72ppi does not.
Question:-
Is there some convention regarding resolution settings whereby a fiddle-factor is used?
Andrew
[1]: BITMAPHEADERINFO
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/gdi/bitmaps_1rw2.asp
[2]: NIST Guide to SI Units
http://physics.nist.gov/Pubs/SP811/appenB.html
Related Tags
How to Master Sharpening in Photoshop
Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.