(type egg)
(signature "stb-image-resize egg")
(timestamp 1612269487)
(sxml ((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/stb-image-resize" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "stb-image-resize" (toc) (p "This is a " (link "http://call-cc.org" "CHICKEN") " egg that wraps " (link "https://github.com/nothings/stb" ("stb" (i "image") "resize.h")) " version 0.95 from Jorge L Rodriguez and friends. It works on " (link "http://call-cc.org" "CHICKEN") " 4 and 5.")) (section 2 "Repository" (p (link "https://github.com/kristianlm/chicken-stb-image-resize" "https://github.com/kristianlm/chicken-stb-image-resize"))) (section 2 "API" (toc) (def (sig (procedure " (image-resize pixels width height channels target-width target-height #!key filter region alpha-channel)" (id image-resize))) (p "Takes in raw " (tt "pixels") " (a srfi-4 u8/u16/u32/f32vector) of size " (tt "width") (i (tt "height")) (tt "channels") " and returns raw pixels after resizing. The returned type is the same as " (tt "pixels") "' of size " (tt "target-width") (i (tt "target-height")) (tt "channels") ".") (p (tt "channels") " must be an integer between 0 and 64 and keys are processed as follows.") (ul (li (tt "filter:") " one of " (tt "box") ", " (tt "triangle") ", " (tt "cubicbspline") ", " (tt "catmullrom") " or " (tt "mitchell") ". The default uses " (tt "catmullrom") " for up-sampling and " (tt "mitchell") " for down-sampling.") (li (tt "region:") " a vector of 4 elements " (tt "s0 t0 s1 t1") ", representing the UV-coordinates to use as source image. This can be used to crop the image. These values must be in the range of " (tt "[0, 1]") " and represent the fraction of the input image. " (tt "#(0 0 0.5 1)") ", for example, cuts off the right half of the image.") (li (tt "alpha-channel:") " index of channel which is the alpha channel in the image. supply " (tt "#f") " (default) for no alpha channel.")))) (section 2 "Examples" (toc) (p "You can try " (tt "example-thumbnail.scm") " like this:") (p (image-link "https://github.com/kristianlm/chicken-stb-image-resize/raw/master/example.png?raw=true")) (p "Or turn a 3x1 greyscale image into a single pixel like this:") (p (tt " $ csi -R srfi-4 -R stb-image-resize -p '(image-resize (f32vector 0 4 8) 3 1 1   1 1)' #f32(4.0) ")))))
