Replies: 1 comment
-
A jpeg image has no transparency and when your png file is written the alpha channel is disabled and the pixels behind it are shown. I would advise you to specify the background color with the following method: using var image = new MagickImage(@"c:\temp\11554.png");
image.ColorAlpha(MagickColors.White);
image.Write(@"c:\temp\11554.jpg"); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Magick.NET version
Q8-AnyAPU 13.5.0
Environment (Operating system, version and so on)
Windows 10 Pro 20H2
Description
Hi,
I am trying to convert a png format image(11554_original.png) to jpg format(11554.jpg) and found out the jpg image is broken.
11554.png was OK, but 11554.jpg wasn't properly converted. I was wondering what I missed here.
Steps to Reproduce
Save as png
string fullFileName = "c:\temp\11554.png";
using (var image = new MagickImage(bits))
{
image.Format = MagickFormat.Png;
File.WriteAllBytes(fullFileName, image.ToByteArray());
}
Save as jpg
string fullFileName = "c:\temp\11554.jpg";
using (var image = new MagickImage(bits))
{
image.Format = MagickFormat.Jpg;
File.WriteAllBytes(fullFileName, image.ToByteArray());
}
Beta Was this translation helpful? Give feedback.
All reactions