-
Magick.NET versionMagick.NET-Q8-AnyCPU 13.10.0 Environment (Operating system, version and so on)Windows 10, .NET Framework 4.8 DescriptionI have encountered 3 PNG images with transparent background which are corrupted when they are loaded by IM and then written to a new path with the JPG extension instead of PNG. This is how we normally change the output filetype when processing a file with IM, and I am not aware of a different method to make IM output the same file with a different filetype. We have not been able to reproduce this with any other PNGs with transparent background so far, and it's unclear to me what might be unique about these files that is causing the corruption. The attached ZIP contains the original PNG files and the resaved JPG files which display the corruption. The first one becomes visibly blurred around the edges of the original image, and the background becomes white. The other two have their background become black instead of the expected white. Can this be resolved with a code change on our end, or can it be fixed in Magick.NET / ImageMagick? AffectedPNGsWithTransparentBackground.zip Steps to Reproduce
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is not wrong but caused by your input image. This is happening because the alpha channel is turned off. The same will happen if you call |
Beta Was this translation helpful? Give feedback.
This is not wrong but caused by your input image. This is happening because the alpha channel is turned off. The same will happen if you call
image.Alpha(AlphaOption.Off
and save your image as apng
file or any other format. I would advise you to callimage.ColorAlpha(MagickColors.White)
first before writing the image because not all transparent pixels have a while color "behind them".