mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-11 08:33:13 +03:00
switch to #z for comment parameter
* means `comment=None` can be passed directly * no need to conditionally run `str.encode()` * clean up checking of whether a comment is passed
This commit is contained in:
parent
399975f1d9
commit
eddc9bdcec
|
@ -736,9 +736,7 @@ def _save(im, fp, filename):
|
||||||
)
|
)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
comment = info.get("comment", im.info.get("comment")) or b""
|
comment = info.get("comment", im.info.get("comment"))
|
||||||
if isinstance(comment, str):
|
|
||||||
comment = comment.encode()
|
|
||||||
|
|
||||||
# "progressive" is the official name, but older documentation
|
# "progressive" is the official name, but older documentation
|
||||||
# says "progression"
|
# says "progression"
|
||||||
|
|
|
@ -1057,7 +1057,7 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(
|
if (!PyArg_ParseTuple(
|
||||||
args,
|
args,
|
||||||
"ss|nnnnnnnnOy#y#y#",
|
"ss|nnnnnnnnOz#y#y#",
|
||||||
&mode,
|
&mode,
|
||||||
&rawmode,
|
&rawmode,
|
||||||
&quality,
|
&quality,
|
||||||
|
|
|
@ -278,7 +278,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
|
||||||
if (context->comment_size > 0) {
|
if (context->comment) {
|
||||||
jpeg_write_marker(&context->cinfo, JPEG_COM, (unsigned char *)context->comment, context->comment_size);
|
jpeg_write_marker(&context->cinfo, JPEG_COM, (unsigned char *)context->comment, context->comment_size);
|
||||||
}
|
}
|
||||||
state->state++;
|
state->state++;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user