Skip to content

BuilderOption Minimum Number Of Transparent Pixel

Moon edited this page May 16, 2021 · 1 revision

When encoding an animation, the pixel of the current image that have not changed from the previous image, can be replaced by transparent pixel. This does not change the data size at this point.

But, when replacing different 'unchanged' pixel with the very same transparent pixel, the data compressor has a better chance to produce a smaller APNG file size.

However, APNG filtering is another way to reduce file size, and those two don´t work together very well.

Depending on the images, this option decreases or increases APNG file size.

This is a lossless transformation.

Examples:

Disable transparent pixel optimization:

ApngBuilder builder = new ApngBuilder();
builder.setMinimumNumberOfTransparentPixel(0);

Enable transparent pixel optimization, only replace unchanged pixel if there are 5 or more in a row:

ApngBuilder builder = new ApngBuilder();
builder.setMinimumNumberOfTransparentPixel(5);

Clone this wiki locally