Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Strange bug with resized imagery saving to jpg format

$
0
0
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?

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>