Skip to content

Commit 482fc77

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/issues/8375#issuecomment-3369175313
1 parent dc360ce commit 482fc77

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

coders/jpeg.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,27 +1254,12 @@ static Image *ReadJPEGImage_(const ImageInfo *image_info,
12541254
units=0;
12551255
if (jpeg_info->saw_JFIF_marker != 0)
12561256
{
1257+
if (jpeg_info->X_density != 0)
1258+
image->x_resolution=(double) jpeg_info->X_density;
1259+
if (jpeg_info->Y_density != 0)
1260+
image->y_resolution=(double) jpeg_info->Y_density;
12571261
if (jpeg_info->density_unit != 0)
1258-
{
1259-
/*
1260-
Units are defined: 1 = DPI, 2 = DPC.
1261-
*/
1262-
image->x_resolution=(double) jpeg_info->X_density;
1263-
image->y_resolution=(double) jpeg_info->Y_density;
1264-
units=(size_t) jpeg_info->density_unit;
1265-
}
1266-
else
1267-
{
1268-
/*
1269-
Optionally scale based on aspect ratio.
1270-
*/
1271-
if ((jpeg_info->X_density != 0) && (jpeg_info->Y_density != 0))
1272-
{
1273-
double aspect_ratio = (double) jpeg_info->Y_density*
1274-
MagickSafeReciprocal((double) jpeg_info->X_density);
1275-
image->y_resolution=image->x_resolution*aspect_ratio;
1276-
}
1277-
}
1262+
units=(size_t) jpeg_info->density_unit;
12781263
}
12791264
if (units == 1)
12801265
image->units=PixelsPerInchResolution;

0 commit comments

Comments
 (0)