Skip to content

Commit ace3fa8

Browse files
committed
Check against mode 1 instead of input mode for Chops.c
1 parent 0457d71 commit ace3fa8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/_avif.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,9 @@ _encoder_add(AvifEncoderObject *self, PyObject *args) {
503503

504504
avifRGBImageSetDefaults(&rgb, frame);
505505

506-
if (strcmp(mode, "RGBA") == 0) {
506+
const ModeID mode = findModeID(mode_name);
507+
508+
if (mode == IMAGING_MODE_RGBA) {
507509
rgb.format = AVIF_RGB_FORMAT_RGBA;
508510
} else {
509511
rgb.format = AVIF_RGB_FORMAT_RGB;

src/libImaging/Chops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ create(Imaging im1, Imaging im2, const ModeID mode) {
6464
int xsize, ysize;
6565

6666
if (!im1 || !im2 || im1->type != IMAGING_TYPE_UINT8 ||
67-
(mode != IMAGING_MODE_UNKNOWN && (im1->mode != mode || im2->mode != mode))) {
67+
(mode != IMAGING_MODE_UNKNOWN &&
68+
(im1->mode != IMAGING_MODE_1 || im2->mode != IMAGING_MODE_1))) {
6869
return (Imaging)ImagingError_ModeError();
6970
}
7071
if (im1->type != im2->type || im1->bands != im2->bands) {

0 commit comments

Comments
 (0)