Skip to content

Commit

Permalink
Ensure PIL.Image.resize() always gets a tuple size
Browse files Browse the repository at this point in the history
Fixes #2247.
  • Loading branch information
musicinmybrain committed Jul 4, 2024
1 parent 136f67c commit e037267
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions trimesh/visual/gloss.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ def get_specular_glossiness(

if diffuseTexture is not None and specularGlossinessTexture is not None:
# reshape to the size of the largest texture
max_shape = [
max_shape = tuple(
max(diffuseTexture.size[i], specularGlossinessTexture.size[i])
for i in range(2)
]
)
if (
diffuseTexture.size[0] != max_shape[0]
or diffuseTexture.size[1] != max_shape[1]
Expand Down
2 changes: 1 addition & 1 deletion trimesh/visual/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ def pack_images(images):
scale = max_tex_size.max() / max_tex_size_individual
max_tex_size = np.round(max_tex_size / scale).astype(np.int64)

unpadded_sizes.append(max_tex_size)
unpadded_sizes.append(tuple(max_tex_size))

# use the same size for all of them to ensure
# that texture atlassing is identical
Expand Down
2 changes: 1 addition & 1 deletion trimesh/visual/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,6 @@ def power_resize(image, resample=1, square=False):

# if we're not powers of two upsize
if (size != new_size).any():
return image.resize(new_size, resample=resample)
return image.resize(tuple(new_size), resample=resample)

return image.copy()

0 comments on commit e037267

Please sign in to comment.