I didn't include it in the website, admittedly because I didn't fully understand it, and I wanted to keep the service as simple as possible.
Would it make sense for this to be the default?
[1] https://i.scaley.io/png-gamma-256x128/i.imgur.com/X9vKa2s.pn...
The ImageWorsener's website as an excellent reading material on image resizing and other transformations. ImageWorsener is a "correctness first" image resizing software.
"The Importance of Being Linear"[1] which just came up on HN a few days ago, discusses some issues with non-linearity, specifically in the context of 3D rendering.
[1] - http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html
It is possible to optimize the linearization steps so that they don't detract too much from the performance, especially if you're using one of the better (i.e. slower) interpolation methods.
[1] http://blog.johnnovak.net/2016/09/21/what-every-coder-should...
The colour experts have a variety of ways to do much better, almost any of them will give you much better results. Pick one and be done. Your undocumented -gamma- option is fine.
If you want the best option you should be prepared to invest a lot of time and attention, in return for which you'll get a result that's perhaps a little better than your -gamma- and a lot better than plain RGB averaging.
Is it about the choice of interpolation algorithm? nearest neighborhood vs linear vs cubic, etc
I've written image processing code in the past, though color accuracy wasn't important to it, and I'm curious to understand this better.
I also currently use ImageOptim and would be curious to know if it handles this.
I define "color" as a visual perception of a spacially homogenous electromagnetic spectra. Notation: c=p(s), meaning color is a perception of a given spectra. It turns out, that these percieved colors form a three dimensional vector space, this vector space is the representation of the infinite dimension vector space of electromagnetic spectras (c_i=p(s_i), p(a * c)=a * p(c), p(c1+c2)=p(c1)+p(c2) ).
We can parametrize this vector space with three numbers. If these numbers are coefficients of a linear system in these space, then we call this parametrization a "linear colorspace". Then physical blending of different spectra results in the same blending in coefficients.
Often we don't use this kind of parametrization (most often sRGB on the web), because perceptual distance is not linear in a linear colorspace, so we can get away with 8 bits per color channel to not introduce obvious banding in the darker regions.
Blending problems occur if someone doesn't know if the three numbers representing a color accually is a member of an actual vector space or not. Nobody would attemt to use the same algorithm in HSV tö blend.
At the same time shaved off 46% of the size (from 4.02 KB to 2.16 KB)
http://i.imgur.com/X9vKa2s.png
https://i.scaley.io/png-256x128/i.imgur.com/X9vKa2s.png
This means that you don't use a linear color space for blending colors.
Sorry about the language, the image is not made by me [1].
[1] https://web.archive.org/web/20120904060524/http://www.4p8.co...
edit:
I see that your backend relies on libvips to do the resizing. I have no experience with it, but I could make libvips-tools' vipsthumbnail program work correctly:
Note the "--linear" option, without it produces the same wrong image.