mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -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,
|
("img-size", 0,
|
||||||
PRC_DESC("If an IMG file without a header is loaded (e.g. img-header-type "
|
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."));
|
"is set to 'none', this specifies the fixed x y size of the image."));
|
||||||
|
|
||||||
ConfigVariableInt jpeg_quality
|
ConfigVariableInt jpeg_quality
|
||||||
("jpeg-quality", 95,
|
("jpeg-quality", 95,
|
||||||
PRC_DESC("Set this to the quality percentage for writing JPEG files. 95 is "
|
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 "
|
"significantly better quality, but do lead to significantly greater "
|
||||||
"size)."));
|
"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
|
ConfigVariableBool png_palette
|
||||||
("png-palette", true,
|
("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
|
ConfigVariableInt bmp_bpp
|
||||||
("bmp-bpp", 0,
|
("bmp-bpp", 0,
|
||||||
|
@ -57,6 +57,7 @@ extern ConfigVariableBool tga_grayscale;
|
|||||||
|
|
||||||
extern ConfigVariableInt jpeg_quality;
|
extern ConfigVariableInt jpeg_quality;
|
||||||
|
|
||||||
|
extern ConfigVariableInt png_compression_level;
|
||||||
extern ConfigVariableBool png_palette;
|
extern ConfigVariableBool png_palette;
|
||||||
|
|
||||||
extern ConfigVariableInt bmp_bpp;
|
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);
|
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.
|
// First, write the header.
|
||||||
|
|
||||||
int true_bit_depth = pm_maxvaltobits(_maxval);
|
int true_bit_depth = pm_maxvaltobits(_maxval);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user