enum cv::ImwritePNGFlags

Overview

Imwrite PNG specific flags used to tune the compression algorithm. Moreā€¦

#include <imgcodecs.hpp>

enum ImwritePNGFlags
{
    IMWRITE_PNG_STRATEGY_DEFAULT      = 0,
    IMWRITE_PNG_STRATEGY_FILTERED     = 1,
    IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
    IMWRITE_PNG_STRATEGY_RLE          = 3,
    IMWRITE_PNG_STRATEGY_FIXED        = 4,
};

Detailed Documentation

Imwrite PNG specific flags used to tune the compression algorithm.

These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage.

  • The effect of IMWRITE_PNG_STRATEGY_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between IMWRITE_PNG_STRATEGY_DEFAULT and IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY.
  • IMWRITE_PNG_STRATEGY_RLE is designed to be almost as fast as IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY, but give better compression for PNG image data.
  • The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately.
  • IMWRITE_PNG_STRATEGY_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.

Enum Values

IMWRITE_PNG_STRATEGY_DEFAULT

Use this value for normal data.

IMWRITE_PNG_STRATEGY_FILTERED

Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better.

IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY

Use this value to force Huffman encoding only (no string match).

IMWRITE_PNG_STRATEGY_RLE

Use this value to limit match distances to one (run-length encoding).

IMWRITE_PNG_STRATEGY_FIXED

Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.