Renamed "add_plt" to "plt"

This commit is contained in:
Andrew Murray 2023-03-27 22:38:29 +11:00
parent 9035e0d6c8
commit 1fd189164c
5 changed files with 8 additions and 8 deletions

View File

@ -409,7 +409,7 @@ def test_crashes(test_file):
def test_plt_marker(): def test_plt_marker():
# Search the start of the codesteam for the PLT box (id 0xFF58) # Search the start of the codesteam for the PLT box (id 0xFF58)
out = BytesIO() out = BytesIO()
test_card.save(out, "JPEG2000", no_jp2=True, add_plt=True) test_card.save(out, "JPEG2000", no_jp2=True, plt=True)
out.seek(0) out.seek(0)
while True: while True:
box_bytes = out.read(2) box_bytes = out.read(2)

View File

@ -354,7 +354,7 @@ def _save(im, fp, filename):
comment = info.get("comment") comment = info.get("comment")
if isinstance(comment, str): if isinstance(comment, str):
comment = comment.encode() comment = comment.encode()
add_plt = info.get("add_plt", False) plt = info.get("plt", False)
fd = -1 fd = -1
if hasattr(fp, "fileno"): if hasattr(fp, "fileno"):
@ -379,7 +379,7 @@ def _save(im, fp, filename):
signed, signed,
fd, fd,
comment, comment,
add_plt, plt,
) )
ImageFile._save(im, fp, [("jpeg2k", (0, 0) + im.size, 0, kind)]) ImageFile._save(im, fp, [("jpeg2k", (0, 0) + im.size, 0, kind)])

View File

@ -1216,7 +1216,7 @@ PyImaging_Jpeg2KEncoderNew(PyObject *self, PyObject *args) {
Py_ssize_t fd = -1; Py_ssize_t fd = -1;
char *comment = NULL; char *comment = NULL;
Py_ssize_t comment_size; Py_ssize_t comment_size;
int add_plt = 0; int plt = 0;
if (!PyArg_ParseTuple( if (!PyArg_ParseTuple(
args, args,
@ -1239,7 +1239,7 @@ PyImaging_Jpeg2KEncoderNew(PyObject *self, PyObject *args) {
&fd, &fd,
&comment, &comment,
&comment_size, &comment_size,
&add_plt)) { &plt)) {
return NULL; return NULL;
} }
@ -1358,7 +1358,7 @@ PyImaging_Jpeg2KEncoderNew(PyObject *self, PyObject *args) {
context->cinema_mode = cine_mode; context->cinema_mode = cine_mode;
context->mct = mct; context->mct = mct;
context->sgnd = sgnd; context->sgnd = sgnd;
context->add_plt = add_plt; context->plt = plt;
return (PyObject *)encoder; return (PyObject *)encoder;
} }

View File

@ -101,7 +101,7 @@ typedef struct {
char *comment; char *comment;
/* Include PLT marker segment */ /* Include PLT marker segment */
int add_plt; int plt;
} JPEG2KENCODESTATE; } JPEG2KENCODESTATE;

View File

@ -502,7 +502,7 @@ j2k_encode_entry(Imaging im, ImagingCodecState state) {
/* Enabling PLT markers only supported in OpenJPEG 2.4.0 and up */ /* Enabling PLT markers only supported in OpenJPEG 2.4.0 and up */
#if ((OPJ_VERSION_MAJOR == 2 && OPJ_VERSION_MINOR >= 4) || OPJ_VERSION_MAJOR > 2) #if ((OPJ_VERSION_MAJOR == 2 && OPJ_VERSION_MINOR >= 4) || OPJ_VERSION_MAJOR > 2)
if (context->add_plt) { if (context->plt) {
const char * plt_option[2] = {"PLT=YES", NULL}; const char * plt_option[2] = {"PLT=YES", NULL};
opj_encoder_set_extra_options(codec, plt_option); opj_encoder_set_extra_options(codec, plt_option);
} }