Re: [dev] [farbfeld] cubic resizing filter

From: FRIGN <>
Date: Sat, 30 Jan 2016 20:12:13 +0100

On Sat, 30 Jan 2016 10:37:49 -0800
Tim Elliott <> wrote:

Hey Tim,

> Here is a cubic (catmull-rom) resizing filter for farbfeld:
> Example usage is:
> $ jpg2ff < in.jpg | ./resize 123 456 | ff2png > out.png
> The arguments indicate the desired maximum height and width. The image
> above will be resized to fit inside a 123x456 box while preserving the
> aspect ratio.

wow, what great news! This is so cool! :D Care to share your experience
using farbfeld to implement this? :)

> It has no external dependencies, but includes a single-file library to
> perform resampling.

That's the spirit! :)

> Interpolation happens with 8-bit components, so this filter truncates
> 16-bit colors to 8-bit, resamples, and then scales 8-bit colors back
> up.
> I could look into supporting 16-bit colors in the interpolator, but
> would be curious what the use cases are first.

It's hard to say actually. On the one hand, you do want to support 16
Bit to minimize discretization errors, on the other hand, it would
not surprise me if it didn't make any difference.
Maybe you could try it out with a simple white-to-black-gradient and
running it through your resizer. Posterization should occur in 8-Bit
You might want to start with a 1000x200 gradient and scale it down to

Thanks for your hard work! :) I'll add your tool to the farbfeld page
when I find the time.


Received on Sat Jan 30 2016 - 20:12:13 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 30 2016 - 20:24:09 CET