GNOME Bugzilla – Bug 332501
Image dpi resolution changes when saved to .bmp file format
Last modified: 2008-01-15 13:05:40 UTC
Windows XP SP 2 Gimp 2.2.10 GTK+ 2.8.9 Sorry if this is a duplicate, i simply couldn't find a duplicate bug report. ^^; While not being a critical bug, I've noticed still that if you save an image as a .bmp file, the dpi resolution will always change itself by 0.01 or so. As an image file example, instead of keeping it's 96.00 dpi like it should, it'll be saved as 95.9866 dpi. Re-sizing it back to 96.00 and re-saving doesn't seem to work, is this behaviour normal for bmp files?
Is the BMP format able to save the ppi value at all? Would help if you could look this up in the specs.
It does appear to save the ppi value, but not correctly. Have also noticed that the print size changes slightly in the same manner. I've done a test and saved the .bmp file as an .xcf after re-scaling the dpi back to 96.00, the .xcf file matains the correct dpi so perhaps there's either something wrong with the .bmp save or is something that's supposed to occur with that format. However as i've also recently opened up .bmp files that wern't saved in Gimp (the ones pre-provided with win xp) to find that all their dpi and print size info to be strangely of the same nature. (71.9836 x 71.9836 dpi) So one guess is it seems possible that it is properly saved, but either the info window's incorrectly reading it or the file's changed upon opening. (i doubt the file's changed as i'd get a warning to save if it was) .bmp files are opened without any noticable image errors though, so maybe it could be left as trivial/wontfix to figure out the reason of the resolution and print size change. Though I personally found it to be a lil strange. ^^; Same image comparisons taken from the Info window: if saved as an .xcf file: Pixel dimensions: 1024 x 723 pixels Print size: 10.667 x 7.531 inches Resolution: 96 x 96 dpi if saved as an .bmp file: Pixel dimensions: 1024 x 723 pixels Print size: 10.668 x 7.532 inches Resolution: 95.9866 x 95.9866 dpi
This is a rounding error. Gimp uses DPI and BMP uses pixels/meter. The BMP plugin computes 96.0 / 2.54 * 100 = 3779.53 which gets casted to a long int (3779). The calculation in the other direction results in 3779.0 / 100 * 2.54 = 95.9866 dpi. There is nothing we can do to fix this exactly, since BMP always stores integers, however, it makes sense to round properly when saving the BMP. Change committed to CVS: 2006-02-26 Simon Budig <simon@gimp.org> * plug-ins/bmp/bmpwrite.c: properly round the resolution entry. Fixes bug #332501.