800
804
IFDBG printf (" Total length of 0x0400 resource: %d\n", (int) sizeof (gshort));
807
/* --------------- Write resolution data ------------------- */
809
gdouble xres = 0, yres = 0;
810
guint32 xres_fix, yres_fix;
814
g_unit = gimp_image_get_unit (image_id);
815
gimp_image_get_resolution (image_id, &xres, &yres);
817
if (g_unit == GIMP_UNIT_MM)
819
gdouble factor = gimp_unit_get_factor (g_unit) / 10.0;
824
psd_unit = PSD_UNIT_CM;
828
psd_unit = PSD_UNIT_INCH;
831
xres_fix = xres * 65536.0 + .5; /* Convert to 16.16 fixed point */
832
yres_fix = yres * 65536.0 + .5; /* Convert to 16.16 fixed point */
834
xfwrite (fd, "8BIM", 4, "imageresources signature (for resolution)");
835
write_gshort(fd, 0x03ed, "0x03ed Id (resolution)");
836
write_gshort (fd, 0, "Id name"); /* Set to null string (two zeros) */
837
write_glong (fd, 16, "0x0400 resource size");
838
write_glong (fd, xres_fix, "hRes (16.16 fixed point)");
839
write_gshort (fd, psd_unit, "hRes unit");
840
write_gshort (fd, psd_unit, "width unit");
841
write_glong (fd, yres_fix, "vRes (16.16 fixed point)");
842
write_gshort (fd, psd_unit, "vRes unit");
843
write_gshort (fd, psd_unit, "height unit");
803
845
/* --------------- Write Active Layer Number --------------- */
805
847
if (ActiveLayerPresent)