Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile sink output options (lower resolution tiles) #1466

Closed
manthey opened this issue Feb 15, 2024 · 1 comment · Fixed by #1490
Closed

Tile sink output options (lower resolution tiles) #1466

manthey opened this issue Feb 15, 2024 · 1 comment · Fixed by #1490
Assignees

Comments

@manthey
Copy link
Member

manthey commented Feb 15, 2024

This could be considered details related to #1002.

When we write an image, we want to be able to control how downsampling is done for lower resolution layers. In vips, we have (https://www.libvips.org/API/current/VipsRegion.html)

VIPS_REGION_SHRINK_MEAN | use the average 
VIPS_REGION_SHRINK_MEDIAN | use the median 
VIPS_REGION_SHRINK_MODE | use the mode 
VIPS_REGION_SHRINK_MAX | use the maximum 
VIPS_REGION_SHRINK_MIN | use the minimum   
VIPS_REGION_SHRINK_NEAREST | use the top-left pixel 

and, in PIL we have https://pillow.readthedocs.io/en/stable/reference/Image.html#resampling-filters. PIL properly does this (see https://zuru.tech/blog/the-dangers-behind-image-resizing).

We want to add an optional kwarg: resample that would an enum that would include the PIL Resample modes and the vips options. For any of the PIL modes, we should just use PIL for downsampling. For other modes, we probably need to implement this with numpy.

Also, when downsampling, to reduce tile edge effects caused by filtering (e.g., when using Lanczos or hamming), we probably want to pick a larger area, downsample that, and crop.

@manthey
Copy link
Member Author

manthey commented Mar 21, 2024

This issue is a superset of #1486

@manthey manthey changed the title Tile sink output options Tile sink output options (lower resolution tiles) Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants