Code: Select all
convert image.jpg -density 1 -units undefined converted.jpg
Attached are two patches to fix this in the JPEG coder; one for 6.8.7 and one for svn develop.
Code: Select all
Index: coders/jpeg.c
===================================================================
--- coders/jpeg.c (revision 13281)
+++ coders/jpeg.c (working copy)
@@ -2173,10 +2173,16 @@
jpeg_info.write_JFIF_header=MagickTrue;
jpeg_info.X_density=(UINT16) floor(image->resolution.x+0.5);
jpeg_info.Y_density=(UINT16) floor(image->resolution.y+0.5);
+
+ /*
+ Set image resolution units.
+ */
if (image->units == PixelsPerInchResolution)
jpeg_info.density_unit=(UINT8) 1;
- if (image->units == PixelsPerCentimeterResolution)
+ else if (image->units == PixelsPerCentimeterResolution)
jpeg_info.density_unit=(UINT8) 2;
+ else
+ jpeg_info.density_unit=(UINT8) 0;
}
jpeg_info.dct_method=JDCT_FLOAT;
option=GetImageOption(image_info,"jpeg:dct-method");
Code: Select all
Index: coders/jpeg.c
===================================================================
--- coders/jpeg.c (revision 13281)
+++ coders/jpeg.c (working copy)
@@ -2139,10 +2139,16 @@
jpeg_info.write_JFIF_header=MagickTrue;
jpeg_info.X_density=(UINT16) floor(image->x_resolution+0.5);
jpeg_info.Y_density=(UINT16) floor(image->y_resolution+0.5);
+
+ /*
+ Set image resolution units.
+ */
if (image->units == PixelsPerInchResolution)
jpeg_info.density_unit=(UINT8) 1;
- if (image->units == PixelsPerCentimeterResolution)
+ else if (image->units == PixelsPerCentimeterResolution)
jpeg_info.density_unit=(UINT8) 2;
+ else
+ jpeg_info.density_unit=(UINT8) 0;
}
jpeg_info.dct_method=JDCT_FLOAT;
option=GetImageOption(image_info,"jpeg:dct-method");
Thank you.