Skip to content

Converting PNG with white background to JPG: results in a black background #710

Answered by dlemstra
briankitt asked this question in General
Discussion options

You must be logged in to vote

Your image has a transparent background. If you want to have a white background when you save the file as a jpeg you can color the alpha channel with the following code:

using (MagickImage reformat = new MagickImage(inputImage))
{
    reformat.ColorAlpha(MagickColors.White);
    reformat.Write(ExportImage);
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dlemstra
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants