Repository navigation
deepzoom: resize tiles to exact target dimensions - #389
Open
chenyangsu wants to merge 1 commit into
Open
chenyangsu wants to merge 1 commit into
chenyangsu wants to merge 1 commit into
Conversation
Signed-off-by: Chen-Yang Su <cysu@stanford.edu>
Member
DCO signed off ✔️All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeepZoomGenerator.get_tile()can return tiles smaller thanget_tile_dimensions()becausePIL.Image.thumbnail()preserves the integer-rounded source region's aspect ratio. Ontests/fixtures/boxes.tiff,get_tile(1, (0, 0)).sizeis(1, 1)instead of(2, 1), andget_tile(6, (0, 0)).sizeis(38, 31)instead of(38, 32). On multi-tile levels, edge tiles in one column get differing widths, departing from the Deep Zoom spec andlibvips dzsave.Using
tile = tile.resize(z_size, ...)matchesget_tile_dimensions()at every level, with tests. Happy to adjust the filter if you prefer.Fixes #111
Testing:
pytest -v(62 passed; 3 new fail onmain),ruffandmypyclean.