Magick.NET icon indicating copy to clipboard operation
Magick.NET copied to clipboard

Add PngWriteDefines

Open dlemstra opened this issue 6 years ago • 8 comments

The PNG encoder has various options that are used when creating the output image. The following options should be added to the new PgnWriteDefines class:

  • png:bit-depth (1,2,4,8,16 (maybe enum?))
  • png:color-type (should use ColorType enum for the input)
  • png:preserve-colormap
  • png:preserve-iCCP
  • png:exclude-chunks and png:exclude-chunks (flags enum (also add all and none))

dlemstra avatar May 26 '18 09:05 dlemstra

Found this because I'm trying to save a black & white image as PNG with a bit depth of 8. Write method is defaulting to using bit depth of 1. Is there a workaround to use for now?

PikminGuts92 avatar Nov 26 '18 20:11 PikminGuts92

@PikminGuts92 I am not sure but I think you can do this: image.Settings.SetDefine(MagickFormat.Png, "bit-depth", "8").

dlemstra avatar Nov 26 '18 22:11 dlemstra

@dlemstra Thank you. That seems to have done the trick.

PikminGuts92 avatar Nov 27 '18 13:11 PikminGuts92

The following options should also be included:

  • png:compression-level
  • png:compression-strategy (enum?)
  • png:compression-filter

dlemstra avatar Nov 25 '19 20:11 dlemstra