Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-01-29 13:38:33 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-01-29 13:38:33 +0300
commitb62e98d4e2b3c0bd8f727e8786601d1974c5b0b9 (patch)
tree521ed83ca8111430110d61b2e5534ab3aa678978 /source/blender/imbuf
parent45d952e04578a36261a2fd7ae8e4b3dcefa15e54 (diff)
parent6f88053d852ad7f04b3d67b1905d88917f481ee3 (diff)
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/jpeg.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 7d4797def8f..440375f60dc 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -413,11 +413,22 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
jpeg_finish_decompress(cinfo);
}
- jpeg_destroy((j_common_ptr)cinfo);
if (ibuf) {
+ /* Density_unit may be 0 for unknown, 1 for dots/inch, or 2 for dots/cm. */
+ if (cinfo->density_unit == 1) {
+ /* Convert inches to meters. */
+ ibuf->ppm[0] = cinfo->X_density / 0.0254f;
+ ibuf->ppm[1] = cinfo->Y_density / 0.0254f;
+ }
+ else if (cinfo->density_unit == 2) {
+ ibuf->ppm[0] = cinfo->X_density * 100.0f;
+ ibuf->ppm[1] = cinfo->Y_density * 100.0f;
+ }
+
ibuf->ftype = IMB_FTYPE_JPG;
ibuf->foptions.quality = MIN2(ibuf_quality, 100);
}
+ jpeg_destroy((j_common_ptr)cinfo);
}
return ibuf;