Index: source/blender/imbuf/intern/bmp.c =================================================================== --- source/blender/imbuf/intern/bmp.c (révision 55196) +++ source/blender/imbuf/intern/bmp.c (copie de travail) @@ -126,6 +126,7 @@ int x, y, depth, skip, i; unsigned char *bmp, *rect; unsigned short col; + double xppm, yppm; (void)size; /* unused */ @@ -145,6 +146,8 @@ x = LITTLE_LONG(bmi.biWidth); y = LITTLE_LONG(bmi.biHeight); depth = LITTLE_SHORT(bmi.biBitCount); + xppm = LITTLE_LONG(bmi.biXPelsPerMeter); + yppm = LITTLE_LONG(bmi.biYPelsPerMeter); #if 0 printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y, @@ -200,6 +203,8 @@ } if (ibuf) { + ibuf->ppm[0] = xppm; + ibuf->ppm[1] = yppm; ibuf->ftype = BMP; } @@ -251,10 +256,10 @@ putShortLSB(24, ofile); putIntLSB(0, ofile); putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile); + putIntLSB((int)(ibuf->ppm[0] + 0.5), ofile); + putIntLSB((int)(ibuf->ppm[1] + 0.5), ofile); putIntLSB(0, ofile); putIntLSB(0, ofile); - putIntLSB(0, ofile); - putIntLSB(0, ofile); /* Need to write out padded image data in bgr format */ for (y = 0; y < ibuf->y; y++) { Index: source/blender/imbuf/intern/openexr/openexr_api.cpp =================================================================== --- source/blender/imbuf/intern/openexr/openexr_api.cpp (révision 55196) +++ source/blender/imbuf/intern/openexr/openexr_api.cpp (copie de travail) @@ -85,6 +85,7 @@ #include #include #include +#include using namespace Imf; using namespace Imath; @@ -302,6 +303,9 @@ for (info = ibuf->metadata; info; info = info->next) header->insert(info->key, StringAttribute(info->value)); + + if (ibuf->ppm[0] > 0.0f) + addXDensity(*header, ibuf->ppm[0] / 39.3700787f); /* 1 meter = 39.3700787 inches */ } static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags) @@ -1142,6 +1146,12 @@ const int is_alpha = exr_has_alpha(file); ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0); + + if (hasXDensity(file->header())) { + ibuf->ppm[0] = xDensity(file->header()) * 39.3700787f; + ibuf->ppm[1] = ibuf->ppm[0] * file->header().pixelAspectRatio(); + } + ibuf->ftype = OPENEXR; if (!(flags & IB_test)) {