My goal is to convert a pcx image to png. The pcx image has transparent background and white lines\sketch.
I tried converting it using the below:
magick convert abc.pcx abc.png
magick convert abc.pcx -flatten abc.png
magick convert abc.pcx -background white -flatten abc.png
I also tried doing it programmatically (which is my ultimate goal) but nothing
using (var magickImage = new MagickImage(file))
{
magickImage.Format = MagickFormat.Png;
// this one kind of works, it does make the background
// transparent but the lines\sketch has white lines and black
// (only at the sketch)
// where we need transparent background and black lines\sketch
// magickImage.FloodFill(MagickColors.Transparent, 0, 0);
var filePng = Path.ChangeExtension(file, ".png");
magickImage.Write(filePng);
}
FYI - when the .pcx image is opened in adobe express shows correctly - transparent background with black lines. When opened in ImageMagick (IMDisplay) shows black background with white lines.
Here is the link with the .pcx and the converted .png https://drive.google.com/file/d/1x2fWswUFWL6hrLRCW1zuztC1Cry-QDqY/view?usp=sharing
Any ideas what i need to do?
Here how this can be achieved:
using (var magickImage = new MagickImage(file))
{
magickImage.Format = MagickFormat.Png;
magickImage.Negate();
magickImage.Transparent(MagickColors.White);
var filePng = Path.ChangeExtension(file, ".png");
magickImage.Write(filePng);
}