mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-15 02:50:53 +03:00
Do not use MozJPEG progressive default
This commit is contained in:
parent
06e02cc1d9
commit
ae59b03956
|
@ -281,7 +281,10 @@ class TestFileJpeg:
|
||||||
assert not im2.info.get("progressive")
|
assert not im2.info.get("progressive")
|
||||||
assert im3.info.get("progressive")
|
assert im3.info.get("progressive")
|
||||||
|
|
||||||
assert_image_equal(im1, im3)
|
if features.check_feature("mozjpeg"):
|
||||||
|
assert_image_similar(im1, im3, 9.39)
|
||||||
|
else:
|
||||||
|
assert_image_equal(im1, im3)
|
||||||
assert im1_bytes >= im3_bytes
|
assert im1_bytes >= im3_bytes
|
||||||
|
|
||||||
def test_progressive_large_buffer(self, tmp_path: Path) -> None:
|
def test_progressive_large_buffer(self, tmp_path: Path) -> None:
|
||||||
|
@ -424,8 +427,12 @@ class TestFileJpeg:
|
||||||
|
|
||||||
im2 = self.roundtrip(hopper(), progressive=1)
|
im2 = self.roundtrip(hopper(), progressive=1)
|
||||||
im3 = self.roundtrip(hopper(), progression=1) # compatibility
|
im3 = self.roundtrip(hopper(), progression=1) # compatibility
|
||||||
assert_image_equal(im1, im2)
|
if features.check_feature("mozjpeg"):
|
||||||
assert_image_equal(im1, im3)
|
assert_image_similar(im1, im2, 9.39)
|
||||||
|
assert_image_similar(im1, im3, 9.39)
|
||||||
|
else:
|
||||||
|
assert_image_equal(im1, im2)
|
||||||
|
assert_image_equal(im1, im3)
|
||||||
assert im2.info.get("progressive")
|
assert im2.info.get("progressive")
|
||||||
assert im2.info.get("progression")
|
assert im2.info.get("progression")
|
||||||
assert im3.info.get("progressive")
|
assert im3.info.get("progressive")
|
||||||
|
|
|
@ -134,7 +134,16 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compressor configuration */
|
/* Compressor configuration */
|
||||||
|
#ifdef JPEG_C_PARAM_SUPPORTED
|
||||||
|
/* MozJPEG */
|
||||||
|
if (!context->progressive) {
|
||||||
|
/* Do not use MozJPEG progressive default */
|
||||||
|
jpeg_c_set_int_param(
|
||||||
|
&context->cinfo, JINT_COMPRESS_PROFILE, JCP_FASTEST
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
jpeg_set_defaults(&context->cinfo);
|
jpeg_set_defaults(&context->cinfo);
|
||||||
|
|
||||||
/* Prevent RGB -> YCbCr conversion */
|
/* Prevent RGB -> YCbCr conversion */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user