Skip to content

Commit

Permalink
Fix determing grayscale for 1-color palettes
Browse files Browse the repository at this point in the history
  • Loading branch information
almarklein committed Mar 12, 2018
1 parent 309a080 commit a22145a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imageio/plugins/pillow.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def _palette_is_grayscale(pil_image):
palette = np.asarray(pil_image.getpalette()).reshape((256, 3))
# Not all palette colors are used; unused colors have junk values.
start, stop = pil_image.getextrema()
valid_palette = palette[start:stop]
valid_palette = palette[start:stop+1]
# Image is grayscale if channel differences (R - G and G - B)
# are all zero.
return np.allclose(np.diff(valid_palette), 0)
Expand Down

0 comments on commit a22145a

Please sign in to comment.