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

Affine transformation fill parameter seems to do nothing #2837

Closed
Erotemic opened this issue Nov 6, 2017 · 2 comments
Closed

Affine transformation fill parameter seems to do nothing #2837

Erotemic opened this issue Nov 6, 2017 · 2 comments

Comments

@Erotemic
Copy link

Erotemic commented Nov 6, 2017

I would like to use PIL to perform an affine warp on an image, but I want to specify a custom fill value for undefined pixels. The transform function seems to have a fill=1 argument, but it is undocumented and looking further in the code it seems to be unused.

Is there any way to get a custom fill value in an affine transform?

@radarhere radarhere changed the title Affine transformation fill parameter seems to do nothing. Affine transformation fill parameter seems to do nothing Nov 7, 2017
@sharkovsky
Copy link

I am also interested in this!

@wiredfool
Copy link
Member

Internally, in _imaging.c, the fill parameter is passed in, but subsequent calls into the core transform routines set it to 1. In those routines, the fill parameter is a flag for memset(0) on the non-affected locations. In theory, it should be possible to set this fill to some pixel value.

I've got a test implementation in https://github.com/wiredfool/Pillow/tree/issue_2837

It extends the interface rather than repurposing the fill parameter, in case someone is using the fill parameter on an ImagingTransformHandler.

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

No branches or pull requests

3 participants