PNG in Firemonkey : how to specify Compression and 8-bit

  

VCL allows me to specify a PNG’s Compression level (not referring to Quality level).
How do I specify the Compression level of a PNG in FireMonkey? Is there a way to save the PNG as 8-bit instead of 32-bit?
I’m using TBitmapCodecManager. I only need 8-bit because the colors are only black/white (with some anti-aliasing).
Note: I cannot use an external PNG library as this has to be integrated in my code.
begin
var oStream := TMemoryStream.Create;
var Surface := TBitmapSurface.Create;
try
BitmapCodecSaveParams.Quality := 100; // PNG is 100% loss-less, how can we specify the Compression level?
Surface.Assign(aBitmap);
TBitmapCodecManager.SaveToStream(oStream, Surface, ‘.png’, @BitmapCodecSaveParams);
finally
oMemoryStream.Free;
Surf.Free;
end;
end;

Comments are closed.