-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
When attempting to resize a 16 bit image as shown below, a value error appears and crashes the program: "ValueError: image has wrong mode" The image type is "I;16"
The primary problem is that this worked without error in early July and hasn't been touched in a month. When I opened the code today it gave the error even when reverting to a previously stable version. Below is the relevant code inside a custom cropping method. The coord_tup variable is just a tuple that is working as expected
new_im = im.crop(coord_tup)
newSize = (640, 480)
new_im = new_im.resize(newSize, resample=Image.Resampling.LANCZOS)
npImg = np.asarray(new_im)
return npImgAs stated this code used to work fine but when opened this week I get a value error on the line with the resize method, though it will technically work if I change the following
new_im = new_im.resize(newSize, resample=Image.Resampling.LANCZOS)->
new_im = new_im.resize(newSize)I understand through the API documentation that this should default to NEAREST but I could not find anything stating that LANCZOS would not work with 16 bit imaging
- OS: macOS Sonoma 14.6.1 (23G93
- Python: 3.12.3
- Pillow: 10.4.0