Quantization example code #2265
Answered
by
JimBobSquarePants
simonmurrell1979
asked this question in
Q&A
-
Hello I hope you are doing well. Is there any example code on loading a PNG image and applying ImageSharp quantization to a PNG file? I have been using PngQuant to compress images but am looking for a better solution and came across this library. Saw example images below. |
Beta Was this translation helpful? Give feedback.
Answered by
JimBobSquarePants
Oct 12, 2022
Replies: 1 comment 3 replies
-
Sure... string inPath = "...";
string outPath = "...";
using Image image = Image.Load(inPath);
image.Save(outPath, new PngEncoder() { ColorType = PngColorType.Palette, BitDepth = PngBitDepth.Bit8 }); There are overloads for Load/Save that take streams also. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
JimBobSquarePants
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure...
There are overloads for Load/Save that take streams also.