matthewwithanm / pilkit

Utilities and processors built for, and on top of PIL
BSD 3-Clause "New" or "Revised" License
196 stars 54 forks source link

Update deprecated Image.Transpose usage #55

Closed bpicolo closed 2 years ago

bpicolo commented 2 years ago

Looks like Pillow has updated the location of expected transpose usages. I believe this fixes it but would appreciate a review – it has been a looooong time since I've been in the habit of contributing to python libs!

site-packages/pilkit/processors/base.py:122: DeprecationWarning: ROTATE_180 is deprecated and will be removed in Pillow 10 (2023-07-01). Use Transpose.ROTATE_180 instead.
    ROTATE_180 = Image.ROTATE_180

.venv/lib/python3.9/site-packages/pilkit/processors/base.py:123
pilkit/processors/base.py:123: DeprecationWarning: ROTATE_270 is deprecated and will be removed in Pillow 10 (2023-07-01). Use Transpose.ROTATE_270 instead.
    ROTATE_270 = Image.ROTATE_270
bpicolo commented 2 years ago

@vstoykov I haven't yet explicitly tested with older PIL but would appreciate any feedback here : )

sharkcz commented 2 years ago

Seems there is some more stuff that will need updates for Pillow 10, for example

====================================================================================== warnings summary ======================================================================================
tests/test_processors.py::test_resizetofill
tests/test_processors.py::test_resizetofit
tests/test_processors.py::test_resize_rounding
tests/test_processors.py::test_resizetofit_mat
tests/test_processors.py::test_resize_antialiasing
tests/test_processors.py::test_upscale
tests/test_processors.py::test_upscale
tests/test_processors.py::test_upscale
tests/test_processors.py::test_upscale
  /tmp/rpkg/python-pilkit-15-dc5kcc4z/pilkit-09ffa2ad33318ae5fd3464655c14c7f01ffc2097/pilkit/processors/resize.py:25: DeprecationWarning: ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
    img = img.resize((self.width, self.height), Image.ANTIALIAS)

tests/test_utils.py::test_format_normalization
  /tmp/rpkg/python-pilkit-15-dc5kcc4z/pilkit-09ffa2ad33318ae5fd3464655c14c7f01ffc2097/pilkit/utils.py:314: DeprecationWarning: ADAPTIVE is deprecated and will be removed in Pillow 10 (2023-07-01). Use Palette.ADAPTIVE instead.
    img = img.convert('RGB').convert('P', palette=Image.ADAPTIVE,

-- Docs: https://docs.pytest.org/en/stable/warnings.html