mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-24 15:50:33 +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
|
||||
|
||||
comment = info.get("comment", im.info.get("comment")) or b""
|
||||
if isinstance(comment, str):
|
||||
comment = comment.encode()
|
||||
comment = info.get("comment", im.info.get("comment"))
|
||||
|
||||
# "progressive" is the official name, but older documentation
|
||||
# says "progression"
|
||||
|
|
|
@ -1057,7 +1057,7 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
|
|||
|
||||
if (!PyArg_ParseTuple(
|
||||
args,
|
||||
"ss|nnnnnnnnOy#y#y#",
|
||||
"ss|nnnnnnnnOz#y#y#",
|
||||
&mode,
|
||||
&rawmode,
|
||||
&quality,
|
||||
|
|
|
@ -278,7 +278,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
|
|||
|
||||
case 4:
|
||||
|
||||
if (context->comment_size > 0) {
|
||||
if (context->comment) {
|
||||
jpeg_write_marker(&context->cinfo, JPEG_COM, (unsigned char *)context->comment, context->comment_size);
|
||||
}
|
||||
state->state++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user