Merge branch 'blender-v2.92-release'

This commit is contained in:
Philipp Oeser 2021-01-29 11:38:33 +01:00
commit b62e98d4e2
1 changed files with 12 additions and 1 deletions

View File

@ -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;