## Linear light

Shrinking images involves combining many pixels into one. Arithmetic averaging really ought to be in terms of the number of photons, but (for historical reasons) the values stored in image files are usually related to the voltage that should be applied to the electron gun in a CRT display.

`vipsthumbnail` has an option to perform image shrinking in linear space, that is, a colourspace where values are proportional to photon numbers. For example:

    $ vipsthumbnail fred.jpg --linear

The downside is that in linear mode, none of the very fast shrink-on-load tricks that `vipsthumbnail` normally uses are possible, since the shrinking is done at encode time, not decode time, and is done in terms of CRT voltage, not photons. This can make linear light thumbnailing of large images extremely slow.

For example, for a 10,000 x 10,000 pixel JPEG I see:

    $ time vipsthumbnail wtc.jpg
    real    0m0.317s
    user    0m0.292s
    sys 0m0.016s
    $ time vipsthumbnail wtc.jpg --linear
    real    0m4.660s
    user    0m4.640s
    sys 0m0.016s