Allow arbitrary extrapolation methods

未關閉
#703 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.)

主要語言
Python
星號
14k
分支
2.6k
平均合併
1 天 1 小時
30 天內合併 PR
205

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

python-pillow/Pillow 的其他 Issue

查看 python-pillow/Pillow 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。