mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-28 02:04:36 +03:00
Removed qmin and qmax (#17)
This commit is contained in:
parent
38f0d105e4
commit
1410d23453
2
.github/workflows/macos-install.sh
vendored
2
.github/workflows/macos-install.sh
vendored
|
@ -17,7 +17,7 @@ brew install \
|
||||||
dav1d \
|
dav1d \
|
||||||
aom \
|
aom \
|
||||||
rav1e \
|
rav1e \
|
||||||
ninja
|
svt-av1
|
||||||
if [[ "$ImageOS" == "macos13" ]]; then
|
if [[ "$ImageOS" == "macos13" ]]; then
|
||||||
brew install --ignore-dependencies libraqm
|
brew install --ignore-dependencies libraqm
|
||||||
else
|
else
|
||||||
|
|
2
.github/workflows/test-mingw.yml
vendored
2
.github/workflows/test-mingw.yml
vendored
|
@ -60,10 +60,10 @@ jobs:
|
||||||
mingw-w64-x86_64-gcc \
|
mingw-w64-x86_64-gcc \
|
||||||
mingw-w64-x86_64-ghostscript \
|
mingw-w64-x86_64-ghostscript \
|
||||||
mingw-w64-x86_64-lcms2 \
|
mingw-w64-x86_64-lcms2 \
|
||||||
|
mingw-w64-x86_64-libavif \
|
||||||
mingw-w64-x86_64-libimagequant \
|
mingw-w64-x86_64-libimagequant \
|
||||||
mingw-w64-x86_64-libjpeg-turbo \
|
mingw-w64-x86_64-libjpeg-turbo \
|
||||||
mingw-w64-x86_64-libraqm \
|
mingw-w64-x86_64-libraqm \
|
||||||
mingw-w64-x86_64-libavif \
|
|
||||||
mingw-w64-x86_64-libtiff \
|
mingw-w64-x86_64-libtiff \
|
||||||
mingw-w64-x86_64-libwebp \
|
mingw-w64-x86_64-libwebp \
|
||||||
mingw-w64-x86_64-openjpeg2 \
|
mingw-w64-x86_64-openjpeg2 \
|
||||||
|
|
|
@ -1359,14 +1359,8 @@ as 8-bit RGB(A).
|
||||||
The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
||||||
|
|
||||||
**quality**
|
**quality**
|
||||||
Integer, 1-100, defaults to 75. 0 gives the smallest size and poorest
|
Integer, 0-100, defaults to 75. 0 gives the smallest size and poorest
|
||||||
quality, 100 the largest and best quality. The value of this setting
|
quality, 100 the largest and best quality.
|
||||||
controls the ``qmin`` and ``qmax`` encoder options.
|
|
||||||
|
|
||||||
**qmin** / **qmax**
|
|
||||||
Integer, 0-63. The quality of images created by an AVIF encoder are
|
|
||||||
controlled by minimum and maximum quantizer values. The higher these
|
|
||||||
values are, the worse the quality.
|
|
||||||
|
|
||||||
**subsampling**
|
**subsampling**
|
||||||
If present, sets the subsampling for the encoder. Defaults to ``4:2:0``.
|
If present, sets the subsampling for the encoder. Defaults to ``4:2:0``.
|
||||||
|
@ -1380,6 +1374,10 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
||||||
**speed**
|
**speed**
|
||||||
Quality/speed trade-off (0=slower-better, 10=fastest). Defaults to 6.
|
Quality/speed trade-off (0=slower-better, 10=fastest). Defaults to 6.
|
||||||
|
|
||||||
|
**max_threads**
|
||||||
|
Limit the number of active threads used. By default, there is no limit. If the aom
|
||||||
|
codec is used, there is a maximum of 64.
|
||||||
|
|
||||||
**range**
|
**range**
|
||||||
YUV range, either "full" or "limited". Defaults to "full"
|
YUV range, either "full" or "limited". Defaults to "full"
|
||||||
|
|
||||||
|
@ -1392,8 +1390,17 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
||||||
For tile encoding, the (log 2) number of tile rows and columns to use.
|
For tile encoding, the (log 2) number of tile rows and columns to use.
|
||||||
Valid values are 0-6, default 0.
|
Valid values are 0-6, default 0.
|
||||||
|
|
||||||
|
**autotiling**
|
||||||
|
Split the image up to allow parallelization. Enabled automatically if "tile_rows"
|
||||||
|
and "tile_cols" both have their default values of zero. Requires libavif version
|
||||||
|
**0.11.0** or greater.
|
||||||
|
|
||||||
**alpha_premultiplied**
|
**alpha_premultiplied**
|
||||||
Encode the image with premultiplied alpha. Defaults to ``False``
|
Encode the image with premultiplied alpha. Defaults to ``False``. Requires libavif
|
||||||
|
version **0.9.0** or greater.
|
||||||
|
|
||||||
|
**advanced**
|
||||||
|
Codec specific options. Requires libavif version **0.8.2** or greater.
|
||||||
|
|
||||||
**icc_profile**
|
**icc_profile**
|
||||||
The ICC Profile to include in the saved file.
|
The ICC Profile to include in the saved file.
|
||||||
|
|
|
@ -170,7 +170,7 @@ Many of Pillow's features require external libraries:
|
||||||
instead of installing libavif through Homebrew directly, you can use
|
instead of installing libavif through Homebrew directly, you can use
|
||||||
Homebrew to install libavif's build dependencies::
|
Homebrew to install libavif's build dependencies::
|
||||||
|
|
||||||
brew install aom dav1d rav1e
|
brew install aom dav1d rav1e svt-av1
|
||||||
|
|
||||||
Then see ``depends/install_libavif.sh`` to install libavif.
|
Then see ``depends/install_libavif.sh`` to install libavif.
|
||||||
|
|
||||||
|
|
|
@ -156,8 +156,6 @@ def _save(
|
||||||
|
|
||||||
is_single_frame = total == 1
|
is_single_frame = total == 1
|
||||||
|
|
||||||
qmin = info.get("qmin", -1)
|
|
||||||
qmax = info.get("qmax", -1)
|
|
||||||
quality = info.get("quality", 75)
|
quality = info.get("quality", 75)
|
||||||
if not isinstance(quality, int) or quality < 0 or quality > 100:
|
if not isinstance(quality, int) or quality < 0 or quality > 100:
|
||||||
msg = "Invalid quality setting"
|
msg = "Invalid quality setting"
|
||||||
|
@ -218,8 +216,6 @@ def _save(
|
||||||
im.size[0],
|
im.size[0],
|
||||||
im.size[1],
|
im.size[1],
|
||||||
subsampling,
|
subsampling,
|
||||||
qmin,
|
|
||||||
qmax,
|
|
||||||
quality,
|
quality,
|
||||||
speed,
|
speed,
|
||||||
max_threads,
|
max_threads,
|
||||||
|
|
|
@ -289,8 +289,8 @@ def pilinfo(out: IO[str] | None = None, supported_formats: bool = True) -> None:
|
||||||
("freetype2", "FREETYPE2"),
|
("freetype2", "FREETYPE2"),
|
||||||
("littlecms2", "LITTLECMS2"),
|
("littlecms2", "LITTLECMS2"),
|
||||||
("webp", "WEBP"),
|
("webp", "WEBP"),
|
||||||
("jpg", "JPEG"),
|
|
||||||
("avif", "AVIF"),
|
("avif", "AVIF"),
|
||||||
|
("jpg", "JPEG"),
|
||||||
("jpg_2000", "OPENJPEG (JPEG2000)"),
|
("jpg_2000", "OPENJPEG (JPEG2000)"),
|
||||||
("zlib", "ZLIB (PNG/ZIP)"),
|
("zlib", "ZLIB (PNG/ZIP)"),
|
||||||
("libtiff", "LIBTIFF"),
|
("libtiff", "LIBTIFF"),
|
||||||
|
|
17
src/_avif.c
17
src/_avif.c
|
@ -234,8 +234,6 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
|
||||||
avifEncoder *encoder;
|
avifEncoder *encoder;
|
||||||
|
|
||||||
char *subsampling;
|
char *subsampling;
|
||||||
int qmin;
|
|
||||||
int qmax;
|
|
||||||
int quality;
|
int quality;
|
||||||
int speed;
|
int speed;
|
||||||
int exif_orientation;
|
int exif_orientation;
|
||||||
|
@ -255,12 +253,10 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(
|
if (!PyArg_ParseTuple(
|
||||||
args,
|
args,
|
||||||
"IIsiiiiissiiOOSSiSO",
|
"IIsiiissiiOOSSiSO",
|
||||||
&width,
|
&width,
|
||||||
&height,
|
&height,
|
||||||
&subsampling,
|
&subsampling,
|
||||||
&qmin,
|
|
||||||
&qmax,
|
|
||||||
&quality,
|
&quality,
|
||||||
&speed,
|
&speed,
|
||||||
&max_threads,
|
&max_threads,
|
||||||
|
@ -327,17 +323,12 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
|
||||||
_codec_available("aom", AVIF_CODEC_FLAG_CAN_ENCODE));
|
_codec_available("aom", AVIF_CODEC_FLAG_CAN_ENCODE));
|
||||||
encoder->maxThreads = is_aom_encode && max_threads > 64 ? 64 : max_threads;
|
encoder->maxThreads = is_aom_encode && max_threads > 64 ? 64 : max_threads;
|
||||||
|
|
||||||
if (qmin == -1 || qmax == -1) {
|
|
||||||
#if AVIF_VERSION >= 1000000
|
#if AVIF_VERSION >= 1000000
|
||||||
encoder->quality = quality;
|
encoder->quality = quality;
|
||||||
#else
|
#else
|
||||||
encoder->minQuantizer = normalize_quantize_value(64 - quality);
|
encoder->minQuantizer = normalize_quantize_value(64 - quality);
|
||||||
encoder->maxQuantizer = normalize_quantize_value(100 - quality);
|
encoder->maxQuantizer = normalize_quantize_value(100 - quality);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
encoder->minQuantizer = normalize_quantize_value(qmin);
|
|
||||||
encoder->maxQuantizer = normalize_quantize_value(qmax);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(codec, "auto") == 0) {
|
if (strcmp(codec, "auto") == 0) {
|
||||||
encoder->codecChoice = AVIF_CODEC_CHOICE_AUTO;
|
encoder->codecChoice = AVIF_CODEC_CHOICE_AUTO;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user