

Ask HN: How complex is image resizing? - earthlingzephyr

I was talking with a friend the other day, and he led me to believe that the process of trying to shrink an image while maintaining as much of the quality as possible is not a simple thing to do.<p>I'm curious to what extent this is actually true.  For instance, I assume there's a real difference between stretching and shrinking using Windows Paint and Adobe Photoshop, but how much of a difference?  And is Photoshop 'the last word' or are there more complex techniques that can be employed?
======
wmf
Consider <http://en.wikipedia.org/wiki/Lanczos_resampling> \-- inventing this
stuff required Serious Math Skills, but implementing it is probably not that
difficult (provided you know the right keywords to Google).

Related discussion about how all software does it wrong:
<http://news.ycombinator.com/item?id=1141971>

------
Qz
There are a few standard algorithms, like Bicubic, trilinear, and others.
Photoshop generally lets you choose. Different algorithms work better for
different types of images, and also depend on whether you're shrinking or
enlarging. Photoshop has the most common ones and probably works for 95% of
common cases.

~~~
Travis
And I've heard that it will generally select appropriate presets when you do
the whole "export for web and devices" option...

------
nzmsv
For a project in first year uni, I implemented nearest neighbour, bilinear,
bicubic, and sinc. I remember sinc looking marginally better than bicubic, but
not significantly so for most images (which is probably why Photoshop didn't
implement it at the time - I don't know if it does now).

How hard it is depends on what you mean by hard. Coding these algorithms took
an evening or two, but I didn't know about the gamma problem until I read the
link in these comments, so it is not trivial.

------
mbrubeck
It's not that complex, but it's complex enough that even Adobe Photoshop gets
it partly wrong:

<http://www.4p8.com/eric.brasseur/gamma.html>

<http://news.ycombinator.com/item?id=1141971>

