FreeImage JPGs DPI
BlitzPlus Forums/BlitzPlus Programming/FreeImage JPGs DPI
| ||
I'm having a problem when I load up a JPG to be resized and saved using FreeImage (the library, not the function) It's a 180 DPI image to begin with, and I'm not sure at which point it loses sight of this, but when it resaves, it saves as 72 DPI (a very big no no). Does anyone know of a way to keep that DPI setting (or perhaps tack it into the file, since the pixel dimensions end up being correct, just not the DPI info)? Any help would be appreciated, thanks! -Tyler |
| ||
I don't follow. DPI is largely irrelevant for games? |
| ||
Not doing a program for games :) The image has to retain a print quality dpi. |
| ||
N/m, I found out what I needed to do. For anyone whose curious, I had to use a WriteFile(theFile), then seekfile/writebyte for a few spots, they are as follows. dpiHex = 180 ;d4h - actually, but writebyte uses decimal ; These first seek/writes change the dpi from cm to inches SeekFile (hexStream, 11) WriteByte hexStream, 1 SeekFile (hexStream, 12) WriteByte hexStream, 2 SeekFile (hexStream, 13) WriteByte hexStream, 1 ; - These were the actual dpi byte locations (for my jpg files) SeekFile (hexStream, 15) WriteByte hexStream, dpiHex SeekFile (hexStream, 17) WriteByte hexStream, dpiHex Your jpeg files may have a different layout (which seems counterintuitive to standardization), but you can play around in a hex editor and figure out which of the first few bytes steers your jpg's dpi through trial and error. It seems to consist of 2 bytes total for each dimension (x&y, respectively), so the b4h value will be preceded by 00 (like 00 b4 00 b4) I had to change both values at the same time, otherwise I would get an aspect ratio warning from Photoshop. Hope this helps someone else :) -Tyler |