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

Strange bug with resized imagery saving to jpg format

Apr 4 at 8:57 PM
Edited Apr 4 at 8:58 PM
Running on the current nuget version of Magick.NET-Q8-AnyCPU (7.0.5.500) I hit a very strange bug. For input I have an oddly sized tiff:
{Tiff 7200x4792 1-bit Gray 124.21kB}
The image is predominately white with some black drawing and text on it.
My app takes that input, rotates it 90 degrees, resizes it down to something much smaller, then saves it as a jpeg:
MagickImage img = new MagickImage("Input.tiff");
img.Rotate(90);
img.Resize(700, 0);
img.Format = MagickFormat.Jpeg;
img.Write("Output.jpg");
The resulting output file is an entirely black image.
If I remove the call to Resize(), the output jpeg file is fine:
MagickImage img = new MagickImage("Input.tiff");
img.Rotate(90);
img.Format = MagickFormat.Jpeg;
img.Write("Output.jpg");
Alternatively, if I leave the Resize() in place and save the file as a Png24, the the output file is fine:
MagickImage img = new MagickImage("Input.tiff");
img.Rotate(90);
img.Resize(700, 0);
img.Format = MagickFormat.Png24;
img.Write("Output.png");
Now, this is where it gets strange ... leaving the Resize() call in place, if I save the file 1st as a PNG and then as a JPG, the output jpg file is fine:
MagickImage img = new MagickImage("Input.tiff");
img.Rotate(90);
img.Resize(700, 0);
img.Format = MagickFormat.Png24;
img.Write("Output.png");
img.Format = MagickFormat.Jpeg;
img.Write("Output.jpg");
Any thoughts as to what is going on under the hood?
Coordinator
Apr 4 at 9:44 PM
Edited Apr 5 at 6:34 AM
Can you share your input tiff image? It would make it easier for me to debug the issue. Feel free to contact me through CodePlex if you don't want to share your image in public.

EDIT: Is it possible that your tiff image is transparent instead of white?
Apr 5 at 2:27 PM
Hmm. That is a good question ... and honestly I wasn't even aware that tiff images had an alpha channel for transparency. Opening the image in Paint.Net seems to indicate that it is not transparent.

See if this URL works to download the image. It should work for ~10 days:
Sample TIFF Image
Coordinator
Apr 6 at 7:08 AM
I can reproduce your issue. Now I have to figure out why this is happening. Will get back to you when I have more information.
Coordinator
Apr 6 at 9:58 PM
I have found the issue and just published Magick.NET 7.0.5.501. And after you have upgrade I would also advise you to do the rotate after you resize the image. The rotate will need to work on a much smaller area and this could be a bit faster.