This project has moved. For the latest updates, please go here.

Improper JPEG sampling factors

Jan 7, 2015 at 5: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 7.0.0.7

A sample file is here
https://app.box.com/s/8lfqekv98dc615ezrld6

Thanks,
Darren
Coordinator
Jan 7, 2015 at 5: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 5:45 PM
Windows image viewer does NOT open it. I have not found any viewer that opens it other than Photoshop.
Coordinator
Jan 7, 2015 at 9:30 PM
I was able to get the following image: https://www.dropbox.com/s/8mo3yldgiogksmz/E3_p1_1.png?dl=0. 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.