Skip to content

Commit

Permalink
If needed, revert to tostring() for PIL-compatibility (closes #39).
Browse files Browse the repository at this point in the history
  • Loading branch information
tboggs committed Feb 10, 2016
1 parent 1df16ad commit 1e3a9d2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spectral/graphics/hypercube.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,12 @@ def load_textures(self):
(a, b, c) = data.shape
texSizes = [(b, a), (b, c), (a, c), (b, c), (a, c), (b, a)]
for i in range(len(images)):
img = images[i].tobytes("raw", "RGBX", 0, -1)
try:
# API change for Pillow
img = images[i].tobytes("raw", "RGBX", 0, -1)
except:
# Fall back to old PIL API
img = images[i].tostring("raw", "RGBX", 0, -1)
(dim_x, dim_y) = images[i].size
texImages.append(img)

Expand Down

0 comments on commit 1e3a9d2

Please sign in to comment.