jpeg decoder: quality regression in chroma upsampling

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Posts: 1
Joined: 2013-04-03T15:53:13-07:00
Authentication code: 6789

jpeg decoder: quality regression in chroma upsampling

Post by pengvado »

Recent versions of imagemagick produce lower-quality decoding of subsampled jpegs than older versions did. I noticed the problem in 6.8.4-6 2013-04-03 Q16, and tracked the regression to svn-r7275. That commit message ("Change IsMagickTrue() to more sensible name IsStringTrue()") implies it was only supposed to be a refactoring, but it in fact changed the default upsampling algorithm.

Patch to revert to the previous behavior, i.e. keeping libjpeg defaults:

Code: Select all

--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -1126,7 +1126,8 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
       jpeg_info.desired_number_of_colors=(int) StringToUnsignedLong(option);
-  jpeg_info.do_block_smoothing=IsStringTrue(option);
+  if (option != (const char *) NULL)
+    jpeg_info.do_block_smoothing=IsStringTrue(option);
   if (option != (const char *) NULL)
@@ -1159,7 +1160,8 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
-  jpeg_info.do_fancy_upsampling=IsStringTrue(option);
+  if (option != (const char *) NULL)
+    jpeg_info.do_fancy_upsampling=IsStringTrue(option);
   (void) jpeg_start_decompress(&jpeg_info);

User avatar
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: jpeg decoder: quality regression in chroma upsampling

Post by magick »

Thanks for the patch, we'll get it into the Subversion trunk by sometime tomorrow.

User avatar
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: jpeg decoder: quality regression in chroma upsampling

Post by anthony »

Shouldn't that be GetImageArtifact() instead of GetImageOption() ????
Anthony Thyssen -- Webmaster for ImageMagick Example Pages