{"action":"created","issue":{"url":"https://api.github.com/repos/python-pillow/Pillow/issues/3242","repository_url":"https://api.github.com/repos/python-pillow/Pillow","labels_url":"https://api.github.com/repos/python-pillow/Pillow/issues/3242/labels{/name}","comments_url":"https://api.github.com/repos/python-pillow/Pillow/issues/3242/comments","events_url":"https://api.github.com/repos/python-pillow/Pillow/issues/3242/events","html_url":"https://github.com/python-pillow/Pillow/pull/3242","id":339111844,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5ODc3MDE2","number":3242,"title":"Add feature: ImageOps.colorize to support three colors","user":{"login":"tsennott","id":28113523,"node_id":"MDQ6VXNlcjI4MTEzNTIz","avatar_url":"https://avatars0.githubusercontent.com/u/28113523?v=4","gravatar_id":"","url":"https://api.github.com/users/tsennott","html_url":"https://github.com/tsennott","followers_url":"https://api.github.com/users/tsennott/followers","following_url":"https://api.github.com/users/tsennott/following{/other_user}","gists_url":"https://api.github.com/users/tsennott/gists{/gist_id}","starred_url":"https://api.github.com/users/tsennott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsennott/subscriptions","organizations_url":"https://api.github.com/users/tsennott/orgs","repos_url":"https://api.github.com/users/tsennott/repos","events_url":"https://api.github.com/users/tsennott/events{/privacy}","received_events_url":"https://api.github.com/users/tsennott/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-07T02:58:44Z","updated_at":"2018-07-07T07:30:05Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/python-pillow/Pillow/pulls/3242","html_url":"https://github.com/python-pillow/Pillow/pull/3242","diff_url":"https://github.com/python-pillow/Pillow/pull/3242.diff","patch_url":"https://github.com/python-pillow/Pillow/pull/3242.patch"},"body":"Changes proposed in this pull request:\r\n * Added optional arguments to allow for a third color (`mid`) to be specified in `ImageOps.colorize()`, and the ability to choose where this color is applied in the [black, white] range (`midpoint`)\r\n* While re-writing `colorize`, I formatted that function to pep8\r\n\r\n Comments:\r\n* I was using `ImageOps.colorize()` to try to generate a image resembling a cyanotype, and found the two colors for mapping limiting. See attached images for a sense of how the change allows a more dynamic mapping\r\n* I added the test `test_imageops.test_colorize()` to test the functionality and it is passing on Travis. However I'm not sure how to automatically test the gradient mapping without a test image, so I attached an image showing a stoplight gradient with a slight offset in the midpoint, demonstrating that the effect works smoothly. Test code to generate this is `ImageOps.colorize(image_gradient, 'red', 'green', 'yellow', 100)` where `image_gradient` is a black to white gradient image\r\n* I tested the docs and they seem to be building fine with my updated docstring\r\n\r\nTwo-color:\r\n![test_2color](https://user-images.githubusercontent.com/28113523/42406121-8008009c-8156-11e8-8ea1-081f1418c451.jpg)\r\nThree color:\r\n![test_3color](https://user-images.githubusercontent.com/28113523/42406120-7feec2a8-8156-11e8-866e-c612c44fc0fd.jpg)\r\nGradient test:\r\n![test_gradient_offset](https://user-images.githubusercontent.com/28113523/42406123-802040a8-8156-11e8-8c8d-0e7bcf3685ba.jpg)\r\n"},"comment":{"url":"https://api.github.com/repos/python-pillow/Pillow/issues/comments/403195751","html_url":"https://github.com/python-pillow/Pillow/pull/3242#issuecomment-403195751","issue_url":"https://api.github.com/repos/python-pillow/Pillow/issues/3242","id":403195751,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzE5NTc1MQ==","user":{"login":"radarhere","id":3112309,"node_id":"MDQ6VXNlcjMxMTIzMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/3112309?v=4","gravatar_id":"","url":"https://api.github.com/users/radarhere","html_url":"https://github.com/radarhere","followers_url":"https://api.github.com/users/radarhere/followers","following_url":"https://api.github.com/users/radarhere/following{/other_user}","gists_url":"https://api.github.com/users/radarhere/gists{/gist_id}","starred_url":"https://api.github.com/users/radarhere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radarhere/subscriptions","organizations_url":"https://api.github.com/users/radarhere/orgs","repos_url":"https://api.github.com/users/radarhere/repos","events_url":"https://api.github.com/users/radarhere/events{/privacy}","received_events_url":"https://api.github.com/users/radarhere/received_events","type":"User","site_admin":false},"created_at":"2018-07-07T07:30:05Z","updated_at":"2018-07-07T07:30:05Z","author_association":"MEMBER","body":"When you say that 'I'm not sure how to automatically test the gradient mapping without a test image'\r\n- if you mean that you don't know how to access your test image from your test code, you are able to add an image to the Tests/images directory as part of your PR. See #2922 for an example.\r\n- if you mean that you don't have an image to be distributed under the Pillow license, you could use one of the existing images in the test suite"}}
{"actor":{"display_login":"radarhere"}}