Show HN: PlutoFilter- A single-header, zero-allocation image filter library in C

https://news.ycombinator.com/rss Hits: 4
Summary

PlutoFilter PlutoFilter is a single-header, zero-allocation image filter library written in C. It applies fast, chainable image effects without any dynamic memory allocation. Compatible with SVG and CSS filter semantics, it makes it easy to reproduce visual effects consistently across platforms. Installation PlutoFilter is a self-contained, single-header library written in standard C99. It can be used in two modes: header-only or implementation. In header-only mode, simply include the header in any source or header file. This exposes all API declarations but does not include the implementation. To include the actual implementation, define PLUTOFILTER_IMPLEMENTATION in one .c or .cpp file before including the header: #define PLUTOFILTER_IMPLEMENTATION #include "plutofilter.h" In all other source files, include the header as usual: #include "plutofilter.h" The macro PLUTOFILTER_API controls the linkage of public functions. By default, it expands to extern , but if you define PLUTOFILTER_BUILD_STATIC before including the header, all functions will be declared static instead. This is useful when embedding the library in a single translation unit to avoid symbol collisions. Example #define PLUTOFILTER_IMPLEMENTATION #include "plutofilter.h" // Replace with real image I/O implementations extern plutofilter_surface_t load_image ( const char * filename ); extern void write_image ( plutofilter_surface_t surface , const char * filename ); int main ( void ) { plutofilter_surface_t surface = load_image ( "input.jpg" ); // filter: contrast(97%) hue-rotate(330deg) saturate(111%) plutofilter_color_transform_contrast ( surface , surface , 0.97f ); plutofilter_color_transform_hue_rotate ( surface , surface , 330.0f ); plutofilter_color_transform_saturate ( surface , surface , 1.11f ); write_image ( surface , "output.jpg" ); return 0 ; } Features Roadmap Gaussian Blur void plutofilter_gaussian_blur ( plutofilter_surface_t in , plutofilter_surface_t out , float std_deviation_x , float...

First seen: 2025-07-17 20:17

Last seen: 2025-07-17 23:17