Let me try and explain how convolution works when resizing images. No tricks like decoding a smaller image from a JPEG, no algorithm combinations, just assessing the speed of convolution resampling calculations. We do account for memory allocation and calculating coefficients needed for operations. All the calculations use data stored in RAM, so we aren’t taking coding/decoding procedures into account. The resampling itself is performed on arrays of 8-bit RGB pixels. The drawback of keeping the original quality is the poor performance of that algorithm. It helps preserve the quality of the source image. In many cases, the most suitable way to do that would be convolution-based resampling. It’s an operation aimed at changing the dimensions of a source image. And, in the age of responsive designs, you want more. This allows to process about 2.5k photos per hour on a single core. The taskĮntry conditions are as follows: a photo shot with the latest iPhone takes about 1.37 sec to get resized to 2 MP via Pillow 2.6 with none of the optimizations implemented. That’s also a part of what I do, so you can always check out the testing results, submit your own data or run your own tests. When someone claims he made something unique, there’s always a question of testing. And that’s the thing, really: you can optimize the code well only when you’re aware of the architecture of a device running it. The lib is also faster than Intel Performance Primitives, low-level building blocks for image processing optimized for a wide range of Intel architectures. On average, Pillow-SIMD is currently resizing images 15 times faster than ImageMagick. I forked Pillow, a Python image processing library used by Uploadcare, and called the fork Pillow-SIMD. Right when I started off, we decided to open the source code. With optimizations, Uploadcare now needs six times fewer servers to handle its load than before. I wasn’t building it for fun: I work for Uploadcare and resizing images has always been a practical issue with on-the-fly image processing. I call it “the fastest resize” because every other library I could find and test was slower. Part 0 is intended to give you the big picture. It doesn’t seem a single article has enough room for that, so I’ll be releasing more. However, I love tech details, so I’m planning to talk over plenty of those. My warmest thanks to fellow Pillow contributors for their comments and motivation: Alex Clark, Hugo van Kemenade, Andrew Murray.Įven though this article is mostly for developers, I seek to keep it simple. I’d like to share my experience hoping I might motivate and inspire you to go optimize things. I made the fastest image resize for modern x86 processors. First published on June 20, 2017, in Insights You will get a versatile image with great quality, that you can send to anyone without taking too much time.Everything Insights Engineering News Product Culture Compliance The fastest production-ready image resize. If you have a huge photo, we recommend resizing it to about 1900 by 1100 pixels, with JPG format and 90% quality. So if you resize your image, decreasing its width and height to a half, your image would have about the same number of pixels as the screens that will display it, and you wouldn't be losing any quality or detail, even looking at your image in full screen mode. Photos from modern cellphones and cameras usually have over 6 million pixels, while most cellphones, tablets, notebook or TV screens have only about 1.5 million pixels, which means you end up seeing a resized version of the image (you only use the full image if you print it). Reducing image size doesn't reduce image quality, although it may lose small details. Image quality will suffer as you increase compression and start losing more data.Īnother method is to resize your photo, decreasing the pixels it takes to store the image. One way is compressing the image, which reduces file size without having to resize it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |