This project has moved and is read-only. For the latest updates, please go here.

Improper JPEG sampling factors

Jan 7, 2015 at 6:05 PM
With Magick.Net I'm getting this error opening an image.

Improper JPEG sampling factors 2,2\nApparently should be 1,1.. `JPEGPreDecode' @ error/tiff.c/TIFFErrors/581"
System.Exception {ImageMagick.MagickCoderErrorException}

The same error message appears when using GIMP so I assume it's part of libtiff.

Is there any way to continue to read the file properly and correct this problem?

This is the code snippet where the error is thrown.
MagickImage curImage = new MagickImage(Path.GetFullPath(file));

I'm using Magick.Net-AnyCPU Q16 net40-client

A sample file is here

Jan 7, 2015 at 6:11 PM
Does Windows image viewer open the image? If it does then I can probably only try to fix this by patching libtiff. Not sure how easy that will be. And if GIMP can still open the image then this might be an error you can catch and ignore.
Jan 7, 2015 at 6:45 PM
Windows image viewer does NOT open it. I have not found any viewer that opens it other than Photoshop.
Jan 7, 2015 at 10:30 PM
I was able to get the following image: But this was done by making a change to the libtiff. I just mailed one of the libtiff maintainers to ask him if this change is valid or if he knows a better way to do it.