Allow arbitrary extrapolation methods

Offen
#703 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
computer-vision

Rechercherichtung

Start by tracing the Image.transform entry point, which the issue identifies as the priority, and compare how Image.filter handles pixels outside the image. Define the supported extrapolation methods and verify that transform can apply them, including an arbitrary Python function, with tests covering the listed border behaviors and transparent output.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Enhancement

Whenever a function needs to extrapolate values of non-existing pixels (i.e. pixels outside of the image), it should be possible to specify the extrapolation method to use.

The extrapolation methods I consider to be most useful are:

  • replicate border
  • replicate border, with alpha set to 0
  • arbitrary constant
  • wrap around
  • arbitrary Python function

See the introduction to http://docs.opencv.org/modules/imgproc/doc/filtering.html for further explanation and other extrapolation methods. There are several Pillow functions where this comes in handy. For example,

image.transform(size, PIL.Image.AFFINE, data, PIL.Image.BICUBIC, extrapolate=REPLICATE_BORDER_ALPHA0)

might produce a rotated and scaled version of the source image on top of a transparent background so you can paste this transformed image into other images easily. Another example:

image.filter(filter, extrapolate=WRAP_AROUND)

might produce a blurred image that you can use for a tiled wallpaper without ugly tile borders.

If you need to prioritize, I consider Image.transform to be more important than Image.filter. (This is because it is quite easy to work around this issue for Image.filter as soon as this is implemented for Image.transform.)

Vorherrschende Sprache
Python
Sterne
14k
Forks
2.6k
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
205

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python-pillow/Pillow

Alle Issues in python-pillow/Pillow

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.