You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this release I'm going to work on performance of most common operations. While Pillow-SIMD is the fastest library for image convolutional resize on CPU, there is still a room for optimizations without using SIMD.
Fast image allocation #2655 Fast image allocation affects almost every operation. Most of them do not require expensive computations and limited only by memory bandwidth, especially with multithreading
New Image.getchannel method #2661 New Image.getchannel() method returns single band from image, which is common operation, especially for alpha channel
Fast split() #2676Fast merge() #2677 Methods image.split() and Image.merge() use several calls of low-level functions im.getband() and im.putband() which is not effective enough. We need specific low-level functions for this operations which will be 2-2.5 times faster
Fast filters #2679 All filters from ImageFilter.py module are single channel. They are applied to multichannel images by splitting original image to bands, applying filter to each band and merging bands again. Applying filters in one pass should be much more effective. This also unlocks SIMD optimizations
Fast unpacking and partially packing #2693 Many functions in Pack.c and Unpack.c operate byte-by-byte (for example ImagingUnpackRGB). This should be more effective to read 4 bytes at once, apply transformation and write back 4 bytes. The same should be much much more effective using 128-bit SIMD registers
I also worried about VIPS benchmarks. Pillow doesn't show good result, because ≈70% of execution time is spending in filter applying (which is one of the most ineffective operation in Pillow). Funny thing is according to my tests Pillow is already faster than Python VIPS in concurrent mode on 4-cores, even with such ineffective filters. My aim to next release is to make Pillow-SIMD on single core as fast as Python VIPS on all 6 cores of Xeon E5-1650 :-> I also want to add VIPS benchmarks to pillow-perf despite the fact that Python VIPS is very hard to install.
Sounds good to me. I'm still mostly away from the keyboard for a few more days, but I'm hoping to have a chance to go through these prs within a week or so.
Feel free to merge pr's that look non controversial and have the required tests / docs.
I'm likely out for the weekend of the 30/1, so I'm thinking of a release on the 2nd. I'd like to get to a stable freeze before the weekend.
There are a few PRs in the queue that need some love. Either having tests written for them, or they need a feature. (Gif disposal needs a per-frame interface. The I;16 tiff one needs review and testing)
I'm beginning to not be a fan of the resolve conflict merges in the github UI. They make massive diffs that mess up clean rebases. I've had to cherry pick a couple of PRs to get around them.
Activity
homm commentedon Aug 11, 2017
In this release I'm going to work on performance of most common operations. While Pillow-SIMD is the fastest library for image convolutional resize on CPU, there is still a room for optimizations without using SIMD.
Image.getchannel()method returns single band from image, which is common operation, especially for alpha channelimage.split()andImage.merge()use several calls of low-level functionsim.getband()andim.putband()which is not effective enough. We need specific low-level functions for this operations which will be 2-2.5 times fasterImageFilter.pymodule are single channel. They are applied to multichannel images by splitting original image to bands, applying filter to each band and merging bands again. Applying filters in one pass should be much more effective. This also unlocks SIMD optimizationsPack.candUnpack.coperate byte-by-byte (for exampleImagingUnpackRGB). This should be more effective to read 4 bytes at once, apply transformation and write back 4 bytes. The same should be much much more effective using 128-bit SIMD registersI also worried about VIPS benchmarks. Pillow doesn't show good result, because ≈70% of execution time is spending in filter applying (which is one of the most ineffective operation in Pillow). Funny thing is according to my tests Pillow is already faster than Python VIPS in concurrent mode on 4-cores, even with such ineffective filters. My aim to next release is to make Pillow-SIMD on single core as fast as Python VIPS on all 6 cores of Xeon E5-1650 :-> I also want to add VIPS benchmarks to pillow-perf despite the fact that Python VIPS is very hard to install.
wiredfool commentedon Aug 11, 2017
Sounds good to me. I'm still mostly away from the keyboard for a few more days, but I'm hoping to have a chance to go through these prs within a week or so.
Feel free to merge pr's that look non controversial and have the required tests / docs.
wiredfool commentedon Sep 9, 2017
Some notes about this release.
I'm likely out for the weekend of the 30/1, so I'm thinking of a release on the 2nd. I'd like to get to a stable freeze before the weekend.
There are a few PRs in the queue that need some love. Either having tests written for them, or they need a feature. (Gif disposal needs a per-frame interface. The I;16 tiff one needs review and testing)
I'm beginning to not be a fan of the resolve conflict merges in the github UI. They make massive diffs that mess up clean rebases. I've had to cherry pick a couple of PRs to get around them.
wiredfool commentedon Sep 9, 2017
homm commentedon Sep 11, 2017
Things nice to have:
ImageOpsmodule in favor ofImageFilter(also likely)aclark4life commentedon Sep 27, 2017
Thanks @homm for creating this ticket. 👍 (Time for quarterly ritual of toggling Not Watching to Watching.)
jbltx commentedon Sep 30, 2017
Thank you @wiredfool for your work on #2769, i didn't find the time to finish it so i'm glad someone was here for that.
wiredfool commentedon Oct 1, 2017
@jbltx You're welcome.
aclark4life commentedon Oct 2, 2017
@python-pillow/pillow-team Should we move this release to Oct 2 or 3?
cgohlke commentedon Oct 2, 2017
I think #2772 is a release blocker.
wiredfool commentedon Oct 2, 2017
radarhere commentedon Oct 2, 2017
For anyone just reading this thread, #2772 has been resolved.
wiredfool commentedon Oct 2, 2017
I think we're pretty nearly done here.
wiredfool commentedon Oct 2, 2017
I've tagged release 4.3.0: https://github.com/python-pillow/Pillow/tree/4.3.0
Linux wheels are done, one OSX build to go.
cgohlke commentedon Oct 2, 2017
Windows binaries are at http://www.lfd.uci.edu/~gohlke/ ...
jbltx commentedon Oct 2, 2017
@cgohlke What is the delay to get this from pip ?
wiredfool commentedon Oct 2, 2017
I'm going to upload them shortly
wiredfool commentedon Oct 2, 2017
Ok, they're uploaded. Thanks for the binaries @cgohlke.
aclark4life commentedon Oct 2, 2017
Thanks all!
hugovk commentedon Oct 3, 2017
paulopires16 commentedon Jan 25, 2018
RGB to PALETTE conversion
I'm trying to convert RGB image to PALETTE image with PIL:
...but, for example, the white color is 245, not 255 :(
And from CMYK to PALETTE? Is it possible?
PIL version: 5.0.0
Thanks
wiredfool commentedon Jan 25, 2018
@paulopires16 Please don't hijack old unrelated threads.
Since it's a palette image, there's no guarantee that any specific color will appear, or where the colors appear in the palette.