Skip to content

Commit

Permalink
Respect collection tile format
Browse files Browse the repository at this point in the history
  • Loading branch information
gasi committed Feb 1, 2022
1 parent 87363f6 commit 2d85290
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
parameter for setting background color of collection tiles. This can be useful
when working with images that don’t compose well on a black background
(default).
- Respect `DeepZoomCollection` `tile_format` parameter.

## Version 2.0.0a2 – January 16, 2020

Expand Down
7 changes: 5 additions & 2 deletions deepzoom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,11 @@ def _append_image(self, path, i):
tile_image = PIL.Image.new(
"RGB", (self.tile_size, self.tile_size), self.tile_background_color
)
q = int(self.image_quality * 100)
tile_image.save(tile_path, "JPEG", quality=q)
if self.tile_format == "jpg":
jpeg_quality = int(self.image_quality * 100)
tile_image.save(tile_path, "JPEG", quality=jpeg_quality)
else:
tile_image.save(tile_path)
tile_image = PIL.Image.open(tile_path)
source_path = "%s/%s/%s_%s.%s" % (
_get_files_path(path),
Expand Down

0 comments on commit 2d85290

Please sign in to comment.