You are looking at historical revision 39572 of this page. It may differ significantly from its current revision.

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

stb-image-resize

This is a CHICKEN egg that wraps stbimageresize.h version 0.95 from Jorge L Rodriguez and friends. It works on CHICKEN 4 and 5.

Repository

https://github.com/kristianlm/chicken-stb-image-resize

API

[procedure] (image-resize pixels width height channels target-width target-height #!key filter region alpha-channel)

Takes in raw pixels (a srfi-4 u8/u16/u32/f32vector) of size widthheightchannels and returns raw pixels after resizing. The returned type is the same as pixels' of size target-widthtarget-heightchannels.

channels must be an integer between 0 and 64 and keys are processed as follows.

Examples

You can try example-thumbnail.scm like this:

Or turn a 3x1 greyscale image into a single pixel like this:

$ csi -R srfi-4 -R stb-image-resize -p '(image-resize (f32vector 0 4 8) 3 1 1 1 1)' #f32(4.0)