Skip to content

Resize image by shrinking using maximum pixels? #4606

Answered by jcupitt
larsmaxfield asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @larsmaxfield,

You could run a rank filter before resizing with nearest. In python:

factor = 5
mask = max.rank(factor, factor, factor * factor - 1).(1.0 / factor, kernel="nearest")

That'd do what you want for int factors at least. Not too quick though!

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@jcupitt
Comment options

@jcupitt
Comment options

@larsmaxfield
Comment options

@jcupitt
Comment options

@larsmaxfield
Comment options

Answer selected by larsmaxfield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants