Skip to content

Commit

Permalink
Rescale instead of thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogabrielsson committed Nov 21, 2024
1 parent a0ca84f commit b41ba98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wsidicom/wsidicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,13 @@ def read_thumbnail(
level = self.pyramids.get(pyramid).get_closest_by_size(thumbnail_size)
region = Region(position=Point(0, 0), size=level.size)
image = level.get_region(region, z, path)
image.thumbnail((size), resample=settings.pillow_resampling_filter)
scale = min(
thumbnail_size.width / image.width, thumbnail_size.height / image.height
)
print(scale)
scaled_size = (round(image.width * scale), round(image.height * scale))
print(scaled_size)
image = image.resize(scaled_size, resample=settings.pillow_resampling_filter)
return image

def read_region(
Expand Down

0 comments on commit b41ba98

Please sign in to comment.