mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
pnmimagetypes: introduce png-compression-level PRC variable
This commit is contained in:
parent
1f017997f9
commit
f09d767c6e
@ -81,6 +81,7 @@ ConfigVariableInt img_size
|
||||
("img-size", 0,
|
||||
PRC_DESC("If an IMG file without a header is loaded (e.g. img-header-type "
|
||||
"is set to 'none', this specifies the fixed x y size of the image."));
|
||||
|
||||
ConfigVariableInt jpeg_quality
|
||||
("jpeg-quality", 95,
|
||||
PRC_DESC("Set this to the quality percentage for writing JPEG files. 95 is "
|
||||
@ -88,10 +89,17 @@ ConfigVariableInt jpeg_quality
|
||||
"significantly better quality, but do lead to significantly greater "
|
||||
"size)."));
|
||||
|
||||
ConfigVariableInt png_compression_level
|
||||
("png-compression-level", 6,
|
||||
PRC_DESC("Set this to the desired compression level for writing PNG images. "
|
||||
"Valid values are 0 (no compression), or 1 (compression, best "
|
||||
"speed) to 9 (best compression). Default is 6. PNG compression is "
|
||||
"lossless."));
|
||||
|
||||
ConfigVariableBool png_palette
|
||||
("png-palette", true,
|
||||
PRC_DESC("Set this true to allow writing palette-based PNG images when possible."));
|
||||
|
||||
PRC_DESC("Set this true to allow writing palette-based PNG images when "
|
||||
"possible."));
|
||||
|
||||
ConfigVariableInt bmp_bpp
|
||||
("bmp-bpp", 0,
|
||||
|
@ -57,6 +57,7 @@ extern ConfigVariableBool tga_grayscale;
|
||||
|
||||
extern ConfigVariableInt jpeg_quality;
|
||||
|
||||
extern ConfigVariableInt png_compression_level;
|
||||
extern ConfigVariableBool png_palette;
|
||||
|
||||
extern ConfigVariableInt bmp_bpp;
|
||||
|
@ -526,6 +526,10 @@ write_data(xel *array, xelval *alpha_data) {
|
||||
|
||||
png_set_write_fn(_png, (void *)this, png_write_data, png_flush_data);
|
||||
|
||||
// The compression level corresponds directly to the compression levels for
|
||||
// zlib.
|
||||
png_set_compression_level(_png, png_compression_level);
|
||||
|
||||
// First, write the header.
|
||||
|
||||
int true_bit_depth = pm_maxvaltobits(_maxval);
|
||||
|
Loading…
x
Reference in New Issue
Block a user