tinyimg 1.0.0
Lightweight image manipulation library for Cloudflare Workers
Loading...
Searching...
No Matches
image.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <stddef.h>
14#include <stdint.h>
15
16#include "tinyimg/tinyimg.h"
17#include "tinyimg/util.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#pragma region image handling
24
31typedef enum TinyImageFormat
32{
33 TINYIMG_FORMAT_UNKNOWN = 0,
34 TINYIMG_FORMAT_PNG = 1,
35 TINYIMG_FORMAT_JPEG = 2,
36 TINYIMG_FORMAT_BMP = 3,
37 TINYIMG_FORMAT_GIF = 4,
38 TINYIMG_FORMAT_TIFF = 5,
39 TINYIMG_FORMAT_WEBP = 6,
40 TINYIMG_FORMAT_AVIF = 7,
41 TINYIMG_FORMAT_HEIF = 8,
43
69
77
90typedef struct {
92 uint32_t width;
94 uint32_t height;
96 uint8_t channels;
98 uint8_t quality;
102 uint8_t* data;
105} TinyImage;
106
119typedef struct {
121 uint32_t width;
123 uint32_t height;
125 uint32_t frames;
129 uint8_t channels;
131 uint8_t bit_depth;
133 uint8_t has_alpha;
135 uint8_t progressive;
137
151typedef struct {
153 uint32_t x;
155 uint32_t y;
157 uint32_t width;
159 uint32_t height;
161 uint8_t scale_den;
163 uint8_t channels;
182 uint8_t effort;
184
220
224typedef struct {
226 uint8_t quality;
228 uint8_t lossless;
230 uint8_t progressive;
239 uint8_t effort;
241
259 TinyImage* image, uint32_t width, uint32_t height, uint8_t channels
260);
261
275 const uint8_t* buffer, size_t buffer_size, TinyImageInfo* info
276);
277
294 TinyImage* image, const uint8_t* buffer, size_t buffer_size
295);
296
319 TinyImage* image, const uint8_t* buffer, size_t buffer_size,
320 uint32_t max_width, uint32_t max_height
321);
322
342 TinyImage* image, const uint8_t* buffer, size_t buffer_size, uint32_t x,
343 uint32_t y, uint32_t width, uint32_t height
344);
345
359 TinyImage* image, const uint8_t* buffer, size_t buffer_size,
360 const TinyDecodeOpts* opts
361);
362
380 const TinyImage* image, TinyImageFormat format, const TinyEncodeOpts* opts,
381 TinyWriter* writer
382);
383
393
405
413
422
434TinyImageFormat tiny_format_sniff(const uint8_t* buffer, size_t buffer_size);
435
449 const TinyImage* image, char* extension, size_t max_length
450);
451
471 const TinyImage* image, uint32_t x, uint32_t y, uint8_t* pixel
472);
473
489 TinyImage* image, uint32_t x, uint32_t y, const uint8_t* pixel
490);
491
499
510uint32_t tiny_image_sizeof(void);
511
518uint32_t tiny_image_getwidth(const TinyImage* image);
519
526uint32_t tiny_image_getheight(const TinyImage* image);
527
534uint32_t tiny_image_getchannels(const TinyImage* image);
535
542uint8_t* tiny_image_getdata(const TinyImage* image);
543
550uint32_t tiny_image_getsize(const TinyImage* image);
551
552#pragma endregion
553
554#pragma region image drawing
555
593
616
629
647 TinyImage* image, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
648 const uint8_t* pixel
649);
650
663 TinyImage* image, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
664 const uint8_t* pixel
665);
666
679 TinyImage* image, int32_t x, int32_t y, uint32_t width, uint32_t height,
680 const uint8_t* pixel
681);
682
695 TinyImage* image, int32_t x, int32_t y, uint32_t width, uint32_t height,
696 const uint8_t* pixel
697);
698
713 TinyImage* image, int32_t x, int32_t y, uint32_t width, uint32_t height,
714 uint32_t radius, const uint8_t* pixel
715);
716
734 TinyImage* image, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
735 uint32_t thickness, const uint8_t* pixel
736);
737
749 TinyImage* image, int32_t center_x, int32_t center_y, uint32_t radius,
750 const uint8_t* pixel
751);
752
764 TinyImage* image, int32_t center_x, int32_t center_y, uint32_t radius,
765 const uint8_t* pixel
766);
767
780 TinyImage* image, int32_t center_x, int32_t center_y, uint32_t radius_x,
781 uint32_t radius_y, const uint8_t* pixel
782);
783
796 TinyImage* image, int32_t center_x, int32_t center_y, uint32_t radius_x,
797 uint32_t radius_y, const uint8_t* pixel
798);
799
811 TinyImage* image, const int32_t* x_points, const int32_t* y_points,
812 size_t num_points, const uint8_t* pixel
813);
814
826 TinyImage* image, const int32_t* x_points, const int32_t* y_points,
827 size_t num_points, const uint8_t* pixel
828);
829
843 TinyImage* image, const int32_t* x_points, const int32_t* y_points,
844 size_t num_points, const uint8_t* pixel, TinyFillRule rule,
845 TinyBlendMode blend
846);
847
859 TinyImage* image, const uint8_t* old_color, const uint8_t* new_color,
860 const uint8_t* tolerance
861);
862
878 TinyImage* dest_image, const TinyImage* src_image, int32_t x, int32_t y
879);
880
895 TinyImage* dest_image, const TinyImage* src_image, int32_t x, int32_t y,
896 float opacity, TinyDrawMode mode, TinyBlendMode blend
897);
898
913 TinyImage* dest_image, const TinyImage* src_image, TinyBlendMode blend
914);
915
926
939
954 TinyImage* image, int32_t x0, int32_t y0, int32_t x1, int32_t y1,
955 const uint8_t* from, const uint8_t* to
956);
957
971 TinyImage* image, int32_t center_x, int32_t center_y, uint32_t radius,
972 const uint8_t* inner, const uint8_t* outer
973);
974
986 TinyImage* image, float angle, float start, float end
987);
988
998 TinyImage* image, uint32_t border_width, const uint8_t* pixel
999);
1000
1017 TinyImage* image, uint32_t left, uint32_t top, uint32_t right,
1018 uint32_t bottom, const uint8_t* pixel
1019);
1020
1041 TinyImage* image, int32_t x, int32_t y, const uint8_t* mask, uint32_t width,
1042 uint32_t height, const uint8_t* color, TinyBlendMode blend
1043);
1044
1045#pragma endregion
1046
1047#pragma region image display list
1048
1050#define TINYIMG_DISPLAY_MAX_SHAPES 64
1051
1053#define TINYIMG_DISPLAY_MAX_POINTS 256
1054
1056#define TINYIMG_DISPLAY_MAX_DEPTH 8
1057
1074
1100
1140
1146uint32_t tiny_display_sizeof(void);
1147
1155
1164
1173
1182int tiny_display_translate(TinyDisplayList* list, float x, float y);
1183
1192int tiny_display_scale(TinyDisplayList* list, float x, float y);
1193
1201int tiny_display_rotate(TinyDisplayList* list, float degrees);
1202
1211int tiny_display_set_transform(TinyDisplayList* list, const float* matrix);
1212
1226 TinyDisplayList* list, float x, float y, float width, float height,
1227 const uint8_t* color
1228);
1229
1243 TinyDisplayList* list, float x, float y, float width, float height,
1244 float radius, const uint8_t* color
1245);
1246
1259 TinyDisplayList* list, float center_x, float center_y, float radius_x,
1260 float radius_y, const uint8_t* color
1261);
1262
1276 TinyDisplayList* list, float x1, float y1, float x2, float y2,
1277 float thickness, const uint8_t* color
1278);
1279
1293 TinyDisplayList* list, const float* x_points, const float* y_points,
1294 size_t num_points, const uint8_t* color, TinyFillRule rule
1295);
1296
1305
1314
1322
1331
1343 const TinyDisplayList* list, int32_t* x, int32_t* y, uint32_t* width,
1344 uint32_t* height
1345);
1346
1347#pragma endregion
1348
1349#pragma region image manipulation
1350
1371 TinyImage* image, uint32_t new_width, uint32_t new_height
1372);
1373
1391 TinyImage* image, uint32_t x, uint32_t y, uint32_t crop_width,
1392 uint32_t crop_height
1393);
1394
1413 TinyImage* image, uint32_t center_x, uint32_t center_y, uint32_t radius
1414);
1415
1436 TinyImage* image, uint32_t center_x, uint32_t center_y, uint32_t radius_x,
1437 uint32_t radius_y
1438);
1439
1460 TinyImage* image, const uint32_t* x_points, const uint32_t* y_points,
1461 size_t num_points
1462);
1463
1471
1479
1487
1495
1504
1519int tiny_image_opacity(TinyImage* image, float opacity);
1520
1542int tiny_image_trim(TinyImage* image, uint8_t tolerance);
1543
1544#pragma endregion
1545
1546#pragma region image transformations
1547
1559
1572int tiny_image_quality(TinyImage* image, int quality);
1573
1582int tiny_image_blur(TinyImage* image, float radius);
1583
1592int tiny_image_sharpen(TinyImage* image, float amount);
1593
1605int tiny_image_brightness(TinyImage* image, float factor);
1606
1618int tiny_image_contrast(TinyImage* image, float factor);
1619
1632int tiny_image_dpr(TinyImage* image, float dpr);
1633
1651int tiny_image_saturation(TinyImage* image, float factor);
1652
1668int tiny_image_hue(TinyImage* image, float angle);
1669
1785
1819
1837 TinyImage* image, uint32_t target_width, uint32_t target_height,
1838 TinyImageFit fit_mode
1839);
1840
1863 TinyImage* image, uint32_t target_width, uint32_t target_height,
1864 TinyImageFit fit_mode, const uint8_t* padding_color
1865);
1866
1896 TinyImage* image, uint32_t target_width, uint32_t target_height,
1897 TinyImageFit fit_mode, const uint8_t* padding_color,
1898 const uint8_t* background_color
1899);
1900
1913 TinyImage* image, uint32_t target_width, uint32_t target_height,
1914 TinyImageFit fit_mode, TinyImageGravity gravity, const uint8_t* background
1915);
1916
1932
1945
1962int tiny_image_remove_background(TinyImage* image, uint8_t tolerance);
1963
1977int tiny_image_zoom(TinyImage* image, float zoom_factor);
1978
2001 TinyImage* image, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
2002 float factor
2003);
2004
2027 TinyImage* image, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
2028 float factor
2029);
2030
2044int tiny_image_gaussian_blur(TinyImage* image, float sigma);
2045
2067 TinyImage* image, float radius, float strength, const uint8_t* color
2068);
2069
2090 TinyImage* image, const uint8_t* color, float opacity
2091);
2092
2121 TinyImage* image, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
2122 const uint8_t* color, float opacity
2123);
2124
2125#pragma endregion
2126
2127#pragma region image effects
2128
2147
2176
2189int tiny_image_apply_matrix(TinyImage* image, const float* matrix);
2190
2198int tiny_image_apply_lut(TinyImage* image, const uint8_t* lut);
2199
2210 TinyImage* image, const uint8_t* red, const uint8_t* green,
2211 const uint8_t* blue
2212);
2213
2229 TinyImage* image, const uint8_t* x_points, const uint8_t* y_points,
2230 size_t num_points
2231);
2232
2240
2253
2262int tiny_image_colorize(TinyImage* image, const uint8_t* color, float strength);
2263
2272int tiny_image_tint(TinyImage* image, const uint8_t* color, float strength);
2273
2281int tiny_image_posterize(TinyImage* image, uint32_t levels);
2282
2290int tiny_image_threshold(TinyImage* image, uint8_t level);
2291
2299int tiny_image_solarize(TinyImage* image, uint8_t level);
2300
2310 TinyImage* image, const uint8_t* shadow, const uint8_t* highlight
2311);
2312
2323 TinyImage* image, const uint8_t* shadow, const uint8_t* highlight,
2324 float balance
2325);
2326
2334int tiny_image_exposure(TinyImage* image, float stops);
2335
2343int tiny_image_fill_light(TinyImage* image, float amount);
2344
2352int tiny_image_temperature(TinyImage* image, float amount);
2353
2362int tiny_image_white_balance(TinyImage* image, float temperature, float tint);
2363
2371int tiny_image_vibrance(TinyImage* image, float amount);
2372
2385 TinyImage* image, float in_black, float in_white, float gamma,
2386 float out_black, float out_white
2387);
2388
2402 TinyImage* image, uint8_t channel, float in_black, float in_white,
2403 float gamma, float out_black, float out_white
2404);
2405
2416 TinyImage* image, const float* shadows, const float* midtones,
2417 const float* highlights
2418);
2419
2427int tiny_image_channel_mixer(TinyImage* image, const float* matrix);
2428
2439 TinyImage* image, float red, float green, float blue
2440);
2441
2450
2463
2472
2473#pragma endregion
2474
2475#pragma region image spatial effects
2476
2488 TinyImage* image, float sigma, float amount, float threshold
2489);
2490
2498int tiny_image_clarity(TinyImage* image, float amount);
2499
2507
2515int tiny_image_emboss(TinyImage* image, float strength);
2516
2524int tiny_image_pixelate(TinyImage* image, uint32_t size);
2525
2538 TinyImage* image, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
2539 uint32_t size
2540);
2541
2549
2557int tiny_image_dilate(TinyImage* image, uint32_t radius);
2558
2566int tiny_image_erode(TinyImage* image, uint32_t radius);
2567
2575int tiny_image_morphology_open(TinyImage* image, uint32_t radius);
2576
2584int tiny_image_morphology_close(TinyImage* image, uint32_t radius);
2585
2593int tiny_image_outline(TinyImage* image, uint32_t radius);
2594
2603int tiny_image_motion_blur(TinyImage* image, float length, float angle);
2604
2612int tiny_image_radial_blur(TinyImage* image, float degrees);
2613
2621int tiny_image_zoom_blur(TinyImage* image, float strength);
2622
2631int tiny_image_tilt_shift(TinyImage* image, float sigma, float band);
2632
2645 TinyImage* image, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
2646 float sigma
2647);
2648
2664 TinyImage* image, int32_t offset_x, int32_t offset_y, float sigma,
2665 const uint8_t* color
2666);
2667
2676int tiny_image_glow(TinyImage* image, float sigma, float strength);
2677
2691int tiny_image_noise(TinyImage* image, float amount, int monochrome);
2692
2700int tiny_image_film_grain(TinyImage* image, float amount);
2701
2709int tiny_image_dither(TinyImage* image, uint32_t levels);
2710
2718int tiny_image_halftone(TinyImage* image, uint32_t cell);
2719
2728
2737int tiny_image_scanlines(TinyImage* image, uint32_t period, float strength);
2738
2739#pragma endregion
2740
2741#pragma region image auto correction
2742
2750
2758
2767
2779
2787
2798
2808 TinyImage* image, float shadows, float highlights
2809);
2810
2818int tiny_image_dehaze(TinyImage* image, float strength);
2819
2820#pragma endregion
2821
2822#pragma region image warps
2823
2837 TinyImage* image, float shear_x, float shear_y, const uint8_t* background
2838);
2839
2854 TinyImage* image, float degrees, const uint8_t* background
2855);
2856
2869 TinyImage* image, const float* quad, const uint8_t* background
2870);
2871
2880int tiny_image_arc(TinyImage* image, float degrees, const uint8_t* background);
2881
2890int tiny_image_barrel(TinyImage* image, float amount);
2891
2899int tiny_image_swirl(TinyImage* image, float degrees);
2900
2909int tiny_image_polar(TinyImage* image, int inverse);
2910
2918int tiny_image_corner_radius(TinyImage* image, uint32_t radius);
2919
2920#pragma endregion
2921
2922#pragma region image analysis
2923
2934 const TinyImage* image, uint8_t channel, uint32_t* bins
2935);
2936
2947int tiny_image_dominant_color(const TinyImage* image, uint8_t* color);
2948
2959 const TinyImage* image, uint32_t count, uint8_t* palette
2960);
2961
2969int tiny_image_average_color(const TinyImage* image, uint8_t* color);
2970
2982int tiny_image_phash(const TinyImage* image, uint64_t* hash);
2983
2991uint32_t tiny_phash_distance(uint64_t first, uint64_t second);
2992
3015 const TinyImage* image, TinyImageGravity gravity, float* x, float* y
3016);
3017
3031int tiny_image_blur_faces(TinyImage* image, float sigma);
3032
3044int tiny_image_pixelate_faces(TinyImage* image, uint32_t size);
3045
3046#pragma endregion
3047
3048#pragma region image metadata
3049
3067 TinyImage* image, const char* exif_data, size_t exif_size
3068);
3069
3088 const TinyImage* image, char** exif_data, size_t* exif_size
3089);
3090
3104
3117
3134 TinyImage* image, const char* key, const char* value
3135);
3136
3155 const TinyImage* image, const char* key, char** value
3156);
3157
3171int tiny_image_has_metadata(const TinyImage* image, const char* key);
3172
3186int tiny_image_remove_metadata(TinyImage* image, const char* key);
3187
3198int tiny_image_get_metadata_count(const TinyImage* image, size_t* count);
3199
3200#pragma endregion
3201
3202#pragma region image conversion
3203
3211
3220
3232
3246int tiny_image_convert_channels(TinyImage* image, uint8_t channels);
3247
3263
3277
3297int tiny_image_set_transparent(TinyImage* image, int enable_transparency);
3298
3307
3308#pragma endregion
3309
3310#ifdef __cplusplus
3311}
3312#endif
int tiny_image_draw_image_ex(TinyImage *dest_image, const TinyImage *src_image, int32_t x, int32_t y, float opacity, TinyDrawMode mode, TinyBlendMode blend)
Draws one image onto another with an opacity, a placement and a blend mode.
int tiny_image_rotate_270(TinyImage *image)
Rotates an image 270 degrees clockwise (or 90 degrees counterclockwise).
int tiny_display_bounds(const TinyDisplayList *list, int32_t *x, int32_t *y, uint32_t *width, uint32_t *height)
The rectangle every shape in the list falls inside.
uint32_t tiny_display_sizeof(void)
Size of a TinyDisplayList, for a host allocating one.
int tiny_image_rotate_90(TinyImage *image)
Rotates an image 90 degrees clockwise.
int tiny_image_glow(TinyImage *image, float sigma, float strength)
Adds a blurred copy of the image to itself, which is a bloom.
uint32_t tiny_image_getheight(const TinyImage *image)
Height of an image in pixels.
int tiny_image_apply_lut(TinyImage *image, const uint8_t *lut)
Applies a 256 entry table of the caller's own to every channel.
int tiny_image_to_grayscale(TinyImage *image)
Converts the image to grayscale.
TinyImageFormat
Image formats supported by TinyImage for conversion and saving.
Definition image.h:32
int tiny_image_strip_exif(TinyImage *image)
Strips the EXIF metadata from the image.
int tiny_image_getpixel(const TinyImage *image, uint32_t x, uint32_t y, uint8_t *pixel)
Retrieves the pixel value at the specified (x, y) coordinates in the image.
int tiny_image_opacity(TinyImage *image, float opacity)
Adjusts the opacity of an image by modifying its alpha channel.
int tiny_image_emboss(TinyImage *image, float strength)
Turns the image into a relief lit from the upper left.
int tiny_image_darken(TinyImage *image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, float factor)
Darkens a specified rectangular region of the image by the given factor.
uint32_t tiny_display_culled(const TinyDisplayList *list)
How many shapes the last render dropped as outside the target.
int tiny_image_swirl(TinyImage *image, float degrees)
Twists the image about its center, most at the center.
int tiny_image_pixelate_region(TinyImage *image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t size)
The same, inside a rectangle.
int tiny_display_polygon(TinyDisplayList *list, const float *x_points, const float *y_points, size_t num_points, const uint8_t *color, TinyFillRule rule)
Adds a polygon.
int tiny_image_film_grain(TinyImage *image, float amount)
Adds noise weighted toward the midtones, which is how film grains.
uint32_t tiny_image_sizeof(void)
Size of a TinyImage, for a host allocating one across the wasm boundary.
int tiny_image_threshold(TinyImage *image, uint8_t level)
Drives every channel to nothing or to full scale.
int tiny_image_fit_with_gravity(TinyImage *image, uint32_t target_width, uint32_t target_height, TinyImageFit fit_mode, TinyImageGravity gravity, const uint8_t *background)
Fits the image to a target, keeping the part the gravity names.
int tiny_image_barrel(TinyImage *image, float amount)
Corrects or introduces lens distortion.
int tiny_image_perspective(TinyImage *image, const float *quad, const uint8_t *background)
Maps the image's four corners onto four arbitrary points.
TinyImageFormat tiny_format_sniff(const uint8_t *buffer, size_t buffer_size)
Identifies a format from a buffer's magic bytes.
int tiny_image_halftone(TinyImage *image, uint32_t cell)
Turns tone into dot area within a cell.
int tiny_image_polar(TinyImage *image, int inverse)
Maps between rectangular and polar coordinates.
int tiny_image_set_transparent(TinyImage *image, int enable_transparency)
Sets the transparency of the image.
int tiny_image_brightness(TinyImage *image, float factor)
Adjusts the brightness of the image.
int tiny_image_color_balance(TinyImage *image, const float *shadows, const float *midtones, const float *highlights)
Shifts the color of the shadows, midtones and highlights apart.
int tiny_display_render(TinyDisplayList *list, TinyImage *image)
Draws every shape onto an image, in one pass over the list.
int tiny_image_colorblind_assist(TinyImage *image, TinyColorblindKind kind)
Moves the colors a given color blindness cannot separate apart.
int tiny_image_radial_blur(TinyImage *image, float degrees)
Averages along arcs about the center.
int tiny_image_fill_ellipse(TinyImage *image, int32_t center_x, int32_t center_y, uint32_t radius_x, uint32_t radius_y, const uint8_t *pixel)
Fills an axis-aligned ellipse.
uint32_t tiny_display_covered(const TinyDisplayList *list)
How many shapes the last render dropped as covered by a later opaque one.
int tiny_image_hline(TinyImage *image, int32_t x1, int32_t y1, int32_t x2, int32_t y2, const uint8_t *pixel)
Draws a horizontal run of pixels.
int tiny_image_tilt_shift(TinyImage *image, float sigma, float band)
Blurs away from a horizontal band left sharp.
int tiny_image_unpremultiply(TinyImage *image)
Divides each color channel by its alpha.
int tiny_image_morphology_open(TinyImage *image, uint32_t radius)
Erodes then dilates, which removes bright specks.
int tiny_display_restore(TinyDisplayList *list)
Pops the transform saved last.
int tiny_image_blur_faces(TinyImage *image, float sigma)
Blurs whatever the detector finds and nothing else.
int tiny_display_ellipse(TinyDisplayList *list, float center_x, float center_y, float radius_x, float radius_y, const uint8_t *color)
Adds an ellipse.
uint32_t tiny_image_info_sizeof(void)
Size of a TinyImageInfo, for a host allocating one across the wasm boundary.
uint32_t tiny_image_getsize(const TinyImage *image)
Bytes an image's pixel data occupies.
int tiny_image_phash(const TinyImage *image, uint64_t *hash)
A 64 bit perceptual hash.
int tiny_image_crop_ellipse(TinyImage *image, uint32_t center_x, uint32_t center_y, uint32_t radius_x, uint32_t radius_y)
Crops an image to an elliptical region defined by the center (center_x, center_y) and the specified r...
int tiny_image_negate(TinyImage *image)
Subtracts every color channel from full scale.
int tiny_display_init(TinyDisplayList *list)
Empties a display list and resets its transform to the identity.
int tiny_image_setpixel(TinyImage *image, uint32_t x, uint32_t y, const uint8_t *pixel)
Writes the pixel value at the specified (x, y) coordinates in the image.
TinyImagePixelType
What the channels of an image mean.
Definition image.h:51
@ TINYIMG_PIXEL_GRAY
One channel, luminance.
Definition image.h:55
@ TINYIMG_PIXEL_RGB
Three channels, red then green then blue.
Definition image.h:63
@ TINYIMG_PIXEL_RGBA
Four channels, red then green then blue then alpha.
Definition image.h:67
@ TINYIMG_PIXEL_GRAY_ALPHA
Two channels, luminance then alpha.
Definition image.h:59
int tiny_image_draw_line(TinyImage *image, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t thickness, const uint8_t *pixel)
Draws a line of the given thickness.
int tiny_display_scale(TinyDisplayList *list, float x, float y)
Scales the current transform.
int tiny_image_sobel(TinyImage *image)
Replaces the image with its Sobel gradient magnitude.
int tiny_image_temperature(TinyImage *image, float amount)
Shifts the white point along the blue to amber axis.
struct TinyImageMeta TinyImageMeta
Metadata carried alongside the pixels.
Definition image.h:76
int tiny_image_get_metadata(const TinyImage *image, const char *key, char **value)
Retrieves the value associated with a custom metadata key from the image.
int tiny_image_fill_polygon(TinyImage *image, const int32_t *x_points, const int32_t *y_points, size_t num_points, const uint8_t *pixel)
Fills a polygon by the even-odd rule.
int tiny_image_gradient_radial(TinyImage *image, int32_t center_x, int32_t center_y, uint32_t radius, const uint8_t *inner, const uint8_t *outer)
Fills the image with a radial gradient.
int tiny_image_remove_background(TinyImage *image, uint8_t tolerance)
Clears the background, making it transparent.
int tiny_image_encode(const TinyImage *image, TinyImageFormat format, const TinyEncodeOpts *opts, TinyWriter *writer)
Encodes an image into a growing byte sink.
int tiny_image_white_balance(TinyImage *image, float temperature, float tint)
Shifts the white point along both axes at once.
int tiny_image_hue(TinyImage *image, float angle)
Adjusts the hue of the image.
TinyFillRule
Which points a polygon fill considers inside.
Definition image.h:601
@ TINYIMG_FILL_NONZERO
Inside when the signed crossings do not cancel.
Definition image.h:614
@ TINYIMG_FILL_EVEN_ODD
Inside when a ray to the point crosses an odd number of edges.
Definition image.h:607
int tiny_image_set_exif(TinyImage *image, const char *exif_data, size_t exif_size)
Sets the EXIF metadata for the image.
int tiny_image_color_overlay_rect(TinyImage *image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, const uint8_t *color, float opacity)
Applies a color overlay to a specified rectangular region of the image with the given color and opaci...
int tiny_image_colorize(TinyImage *image, const uint8_t *color, float strength)
Mixes every pixel toward one color, keeping its luminance.
int tiny_image_dehaze(TinyImage *image, float strength)
Removes a veiling haze by the dark-channel prior.
int tiny_image_levels_channel(TinyImage *image, uint8_t channel, float in_black, float in_white, float gamma, float out_black, float out_white)
The same, on one channel.
int tiny_image_flip_vertical(TinyImage *image)
Flips an image vertically, mirroring it along the horizontal axis.
int tiny_image_convert(TinyImage *image, TinyImageFormat format)
Records the format the image should be written as, dropping anything that format cannot carry.
int tiny_image_average_color(const TinyImage *image, uint8_t *color)
The mean of every pixel, per channel.
int tiny_image_gaussian_blur(TinyImage *image, float sigma)
Applies a Gaussian blur effect to the image.
int tiny_display_blend(TinyDisplayList *list, TinyBlendMode blend)
Sets the blend mode the next shapes are added with.
uint32_t tiny_image_getwidth(const TinyImage *image)
Width of an image in pixels.
int tiny_image_fill_circle(TinyImage *image, int32_t center_x, int32_t center_y, uint32_t radius, const uint8_t *pixel)
Fills a circle.
int tiny_image_convert_channels(TinyImage *image, uint8_t channels)
Converts the image to a given channel count.
int tiny_image_channel_gain(TinyImage *image, float red, float green, float blue)
Scales each channel independently.
int tiny_image_auto_gamma(TinyImage *image)
Applies the gamma that brings the mean luminance to mid gray.
int tiny_display_save(TinyDisplayList *list)
Pushes the current transform.
int tiny_image_scanlines(TinyImage *image, uint32_t period, float strength)
Darkens every nth row.
int tiny_image_crop_circle(TinyImage *image, uint32_t center_x, uint32_t center_y, uint32_t radius)
Crops an image to a circular region defined by the center (center_x, center_y) and the specified radi...
int tiny_image_exposure(TinyImage *image, float stops)
Scales every channel by a power of two.
int tiny_image_flip_horizontal(TinyImage *image)
Flips an image horizontally, mirroring it along the vertical axis.
int tiny_image_outline(TinyImage *image, uint32_t radius)
The difference between a dilation and an erosion.
int tiny_image_auto_levels(TinyImage *image)
Stretches each channel to the full range independently.
TinyColorblindKind
The forms of color blindness the simulation and the assist cover.
Definition image.h:2137
@ TINYIMG_COLORBLIND_PROTANOPIA
Definition image.h:2139
@ TINYIMG_COLORBLIND_DEUTERANOPIA
Definition image.h:2141
@ TINYIMG_COLORBLIND_TRITANOPIA
Definition image.h:2143
@ TINYIMG_COLORBLIND_ACHROMATOPSIA
Definition image.h:2145
int tiny_image_resize(TinyImage *image, uint32_t new_width, uint32_t new_height)
Resamples an image to the specified new width and height.
int tiny_draw_coverage(TinyImage *image, int32_t x, int32_t y, const uint8_t *mask, uint32_t width, uint32_t height, const uint8_t *color, TinyBlendMode blend)
Blends one color through an 8-bit coverage mask.
int tiny_image_motion_blur(TinyImage *image, float length, float angle)
Averages along a straight path.
int tiny_image_noise(TinyImage *image, float amount, int monochrome)
Adds pseudorandom noise.
int tiny_image_gamma_correction(TinyImage *image, float gamma)
Applies gamma correction to the image.
int tiny_image_vignette(TinyImage *image, float radius, float strength, const uint8_t *color)
Applies a vignette effect to the image.
int tiny_image_auto_brightness(TinyImage *image)
Moves the mean luminance to the middle of the range.
#define TINYIMG_DISPLAY_MAX_DEPTH
Definition image.h:1056
int tiny_image_apply_luts(TinyImage *image, const uint8_t *red, const uint8_t *green, const uint8_t *blue)
Applies one table per color channel.
int tiny_image_draw_ellipse(TinyImage *image, int32_t center_x, int32_t center_y, uint32_t radius_x, uint32_t radius_y, const uint8_t *pixel)
Draws the outline of an axis-aligned ellipse.
TinyShapeKind
Definition image.h:1060
@ TINYIMG_SHAPE_POLYGON
Definition image.h:1072
@ TINYIMG_SHAPE_NONE
Definition image.h:1062
@ TINYIMG_SHAPE_RECT
Definition image.h:1064
@ TINYIMG_SHAPE_LINE
Definition image.h:1070
@ TINYIMG_SHAPE_ELLIPSE
Definition image.h:1068
@ TINYIMG_SHAPE_ROUND_RECT
Definition image.h:1066
int tiny_display_rect(TinyDisplayList *list, float x, float y, float width, float height, const uint8_t *color)
Adds a rectangle.
int tiny_image_replace_color(TinyImage *image, const uint8_t *old_color, const uint8_t *new_color, const uint8_t *tolerance)
Replaces every pixel close to one color with another.
int tiny_display_line(TinyDisplayList *list, float x1, float y1, float x2, float y2, float thickness, const uint8_t *color)
Adds a line.
int tiny_image_apply_matrix(TinyImage *image, const float *matrix)
Applies a color matrix of the caller's own.
int tiny_display_round_rect(TinyDisplayList *list, float x, float y, float width, float height, float radius, const uint8_t *color)
Adds a rectangle with rounded corners.
int tiny_image_rotate_180(TinyImage *image)
Rotates an image 180 degrees.
int tiny_image_load_region(TinyImage *image, const uint8_t *buffer, size_t buffer_size, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Loads one rectangle of an image.
int tiny_image_gradient_linear(TinyImage *image, int32_t x0, int32_t y0, int32_t x1, int32_t y1, const uint8_t *from, const uint8_t *to)
Fills the image with a linear gradient.
int tiny_image_shear(TinyImage *image, float shear_x, float shear_y, const uint8_t *background)
Slants the image along one or both axes.
int tiny_image_blur(TinyImage *image, float radius)
Applies a blur effect to the image.
int tiny_image_fit_with_padding_and_background(TinyImage *image, uint32_t target_width, uint32_t target_height, TinyImageFit fit_mode, const uint8_t *padding_color, const uint8_t *background_color)
Resizes an image to fit within the specified target width and height according to the specified fit m...
int tiny_image_decode(TinyImage *image, const uint8_t *buffer, size_t buffer_size, const TinyDecodeOpts *opts)
Loads an image with full control over region, scale and channel count.
int tiny_image_getextension(const TinyImage *image, char *extension, size_t max_length)
Retrieves the file extension associated with the image format.
int tiny_image_gettype(const TinyImage *image, TinyImagePixelType *type)
Retrieves the type of the image (grayscale, grayscale with alpha, RGB or RGBA).
int tiny_image_draw_circle(TinyImage *image, int32_t center_x, int32_t center_y, uint32_t radius, const uint8_t *pixel)
Draws the outline of a circle.
int tiny_image_expand(TinyImage *image, uint32_t left, uint32_t top, uint32_t right, uint32_t bottom, const uint8_t *pixel)
Grows the image by a border around it.
int tiny_image_zoom_blur(TinyImage *image, float strength)
Averages along rays from the center.
uint32_t tiny_image_getchannels(const TinyImage *image)
Channels per pixel.
int tiny_image_rectangle(TinyImage *image, int32_t x, int32_t y, uint32_t width, uint32_t height, const uint8_t *pixel)
Draws the outline of a rectangle, one pixel wide.
int tiny_image_draw_image(TinyImage *dest_image, const TinyImage *src_image, int32_t x, int32_t y)
Draws one image onto another.
int tiny_display_translate(TinyDisplayList *list, float x, float y)
Moves the current transform.
TinyEffort
How much computation an operation may spend to do its best work.
Definition image.h:204
@ TINYIMG_EFFORT_FANCY
Spend what it takes to do the best work available.
Definition image.h:210
@ TINYIMG_EFFORT_FAST
Bound the search, take the cheaper kernel, stay inside a floor.
Definition image.h:218
int tiny_image_fit_with_padding(TinyImage *image, uint32_t target_width, uint32_t target_height, TinyImageFit fit_mode, const uint8_t *padding_color)
Resizes an image to fit within the specified target width and height according to the specified fit m...
int tiny_image_load(TinyImage *image, const uint8_t *buffer, size_t buffer_size)
Loads an image, decoding every pixel.
int tiny_image_palette(const TinyImage *image, uint32_t count, uint8_t *palette)
The colors a palette of the given size would hold.
int tiny_image_despeckle(TinyImage *image)
Replaces each pixel with the median of its 3x3 neighborhood.
int tiny_image_quality(TinyImage *image, int quality)
Sets the quality of the image for lossy formats (e.g., JPEG).
int tiny_image_polygon(TinyImage *image, const int32_t *x_points, const int32_t *y_points, size_t num_points, const uint8_t *pixel)
Draws the edges of a polygon, closing it.
int tiny_image_set_metadata(TinyImage *image, const char *key, const char *value)
Sets a custom metadata key-value pair for the image.
int tiny_image_split_tone(TinyImage *image, const uint8_t *shadow, const uint8_t *highlight, float balance)
Tints the shadows and the highlights differently.
int tiny_image_to_rgba(TinyImage *image)
Converts the image to RGBA format, adding an opaque alpha channel if there was none.
int tiny_image_corner_radius(TinyImage *image, uint32_t radius)
Rounds the image's corners by clearing what falls outside them.
int tiny_image_crop_polygon(TinyImage *image, const uint32_t *x_points, const uint32_t *y_points, size_t num_points)
Crops an image to a polygonal region defined by a series of points (x_points, y_points).
#define TINYIMG_DISPLAY_MAX_SHAPES
Definition image.h:1050
int tiny_image_gradient_fade(TinyImage *image, float angle, float start, float end)
Fades the image toward transparency along a direction.
TinyBlendMode
How a shape's color is combined with what is already there.
Definition image.h:565
@ TINYIMG_BLEND_ADD
Definition image.h:589
@ TINYIMG_BLEND_DARKEN
Definition image.h:577
@ TINYIMG_BLEND_HARD_LIGHT
Definition image.h:585
@ TINYIMG_BLEND_NORMAL
Definition image.h:567
@ TINYIMG_BLEND_OVERLAY
Definition image.h:575
@ TINYIMG_BLEND_DIFFERENCE
Definition image.h:581
@ TINYIMG_BLEND_SUBTRACT
Definition image.h:591
@ TINYIMG_BLEND_MULTIPLY
Definition image.h:571
@ TINYIMG_BLEND_LIGHTEN
Definition image.h:579
@ TINYIMG_BLEND_REPLACE
Definition image.h:569
@ TINYIMG_BLEND_EXCLUSION
Definition image.h:583
@ TINYIMG_BLEND_SOFT_LIGHT
Definition image.h:587
@ TINYIMG_BLEND_SCREEN
Definition image.h:573
int tiny_image_border(TinyImage *image, uint32_t border_width, const uint8_t *pixel)
Draws a border inside the image's edges.
int tiny_image_lighten(TinyImage *image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, float factor)
Lightens a specified rectangular region of the image by the given factor.
int tiny_image_auto_color(TinyImage *image)
Scales each channel so their means agree, which is a gray-world balance.
int tiny_image_dilate(TinyImage *image, uint32_t radius)
Replaces each pixel with the brightest in a radius.
TinyImagePreset
The named looks, each a fixed stack of the adjustments above.
Definition image.h:2156
@ TINYIMG_PRESET_MONO
Definition image.h:2162
@ TINYIMG_PRESET_NOIR
Definition image.h:2158
@ TINYIMG_PRESET_FADE
Definition image.h:2164
@ TINYIMG_PRESET_CHROME
Definition image.h:2160
@ TINYIMG_PRESET_TONAL
Definition image.h:2174
@ TINYIMG_PRESET_COOL
Definition image.h:2170
@ TINYIMG_PRESET_VIVID
Definition image.h:2166
@ TINYIMG_PRESET_WARM
Definition image.h:2168
@ TINYIMG_PRESET_INSTANT
Definition image.h:2172
int tiny_image_get_metadata_count(const TinyImage *image, size_t *count)
Retrieves the count of custom metadata key-value pairs in the image.
TinyImageFit
How an image is made to fit a target width and height.
Definition image.h:1702
@ TINYIMG_FIT_ASPECT_CROP
Crops to the target's extent without resampling.
Definition image.h:1739
@ TINYIMG_FIT_SCALE_DOWN
Fits inside the target without cropping or padding, and never enlarges.
Definition image.h:1711
@ TINYIMG_FIT_STRETCH
Scales each axis independently to the target, distorting the image.
Definition image.h:1768
@ TINYIMG_FIT_ASPECT_CONTAIN
Pads to the target's aspect ratio without resampling.
Definition image.h:1747
@ TINYIMG_FIT_CROP
Fills the target exactly, cropping the overflow, and never enlarges.
Definition image.h:1732
@ TINYIMG_FIT_PAD
Fits inside the target, then pads the shortfall with the background.
Definition image.h:1761
@ TINYIMG_FIT_FILL
Fills the target exactly, cropping the overflow, and never shrinks.
Definition image.h:1776
@ TINYIMG_FIT_SCALE_UP
Fits inside the target without cropping or padding, and never shrinks.
Definition image.h:1783
@ TINYIMG_FIT_CONTAIN
Fits inside the target without cropping or padding.
Definition image.h:1718
@ TINYIMG_FIT_ASPECT_COVER
Crops to the target's aspect ratio without resampling.
Definition image.h:1754
@ TINYIMG_FIT_COVER
Fills the target exactly, cropping whichever axis overflows.
Definition image.h:1724
int tiny_image_focus(const TinyImage *image, TinyImageGravity gravity, float *x, float *y)
Where the part of an image worth keeping is.
int tiny_image_auto_contrast(TinyImage *image)
Stretches the luminance so that a small fraction clips at each end.
int tiny_image_vibrance(TinyImage *image, float amount)
Raises saturation, and least where it is already high.
int tiny_image_fill_rounded_rectangle(TinyImage *image, int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t radius, const uint8_t *pixel)
Fills a rectangle whose corners are rounded.
int tiny_image_unsharp_mask(TinyImage *image, float sigma, float amount, float threshold)
Adds back a multiple of what a blur removed.
int tiny_image_remove_metadata(TinyImage *image, const char *key)
Removes a specific custom metadata key-value pair from the image.
uint32_t tiny_phash_distance(uint64_t first, uint64_t second)
How many bits two perceptual hashes differ in.
int tiny_image_colorblind_simulate(TinyImage *image, TinyColorblindKind kind)
Shows the image as a given color blindness would see it.
int tiny_image_drop_shadow(TinyImage *image, int32_t offset_x, int32_t offset_y, float sigma, const uint8_t *color)
Grows the image and puts a blurred silhouette of it behind.
int tiny_image_contrast(TinyImage *image, float factor)
Adjusts the contrast of the image.
int tiny_image_posterize(TinyImage *image, uint32_t levels)
Rounds every channel to a number of evenly spaced levels.
int tiny_image_zoom(TinyImage *image, float zoom_factor)
Zooms in or out of the image by the specified zoom factor.
int tiny_image_chromatic_aberration(TinyImage *image, float amount)
Offsets the red and blue channels radially.
#define TINYIMG_DISPLAY_MAX_POINTS
Definition image.h:1053
int tiny_image_apply_sepia(TinyImage *image)
Applies a sepia tone effect to the image.
int tiny_image_probe(const uint8_t *buffer, size_t buffer_size, TinyImageInfo *info)
Reads an image's header without decoding any pixels.
int tiny_image_get_exif(const TinyImage *image, char **exif_data, size_t *exif_size)
Retrieves the EXIF metadata from the image.
int tiny_image_invert(TinyImage *image)
Inverts the colors of an image, producing a negative effect.
int tiny_image_blackwhite(TinyImage *image)
Replaces every color channel with the pixel's luminance, keeping the channel count.
int tiny_image_trim(TinyImage *image, uint8_t tolerance)
Removes a uniform border by cropping to what differs from it.
int tiny_image_fill_polygon_with(TinyImage *image, const int32_t *x_points, const int32_t *y_points, size_t num_points, const uint8_t *pixel, TinyFillRule rule, TinyBlendMode blend)
Fills a polygon by a named rule, blended.
int tiny_image_fill_rectangle(TinyImage *image, int32_t x, int32_t y, uint32_t width, uint32_t height, const uint8_t *pixel)
Fills a rectangle.
int tiny_image_duotone(TinyImage *image, const uint8_t *shadow, const uint8_t *highlight)
Maps the tonal range between two colors.
int tiny_image_levels(TinyImage *image, float in_black, float in_white, float gamma, float out_black, float out_white)
Maps an input range onto an output range through a gamma.
TinyImageGravity
Which part of an image a crop keeps, or where a pad puts it.
Definition image.h:1795
@ TINYIMG_GRAVITY_EAST
Definition image.h:1805
@ TINYIMG_GRAVITY_CENTER
Definition image.h:1797
@ TINYIMG_GRAVITY_SOUTH_EAST
Definition image.h:1813
@ TINYIMG_GRAVITY_SOUTH_WEST
Definition image.h:1811
@ TINYIMG_GRAVITY_NORTH_EAST
Definition image.h:1809
@ TINYIMG_GRAVITY_NORTH
Definition image.h:1799
@ TINYIMG_GRAVITY_AUTO
Definition image.h:1815
@ TINYIMG_GRAVITY_NORTH_WEST
Definition image.h:1807
@ TINYIMG_GRAVITY_SOUTH
Definition image.h:1801
@ TINYIMG_GRAVITY_WEST
Definition image.h:1803
@ TINYIMG_GRAVITY_FACE
Definition image.h:1817
int tiny_image_has_metadata(const TinyImage *image, const char *key)
Checks if the image has a specific custom metadata key.
const char * tiny_format_extension(TinyImageFormat format)
Retrieves the conventional file extension of a format, leading dot included.
int tiny_image_composite(TinyImage *dest_image, const TinyImage *src_image, TinyBlendMode blend)
Composites one image over another in place, Porter-Duff source-over.
int tiny_image_premultiply(TinyImage *image)
Multiplies each color channel by its alpha.
int tiny_image_fit(TinyImage *image, uint32_t target_width, uint32_t target_height, TinyImageFit fit_mode)
Resizes an image to fit within the specified target width and height according to the specified fit m...
int tiny_image_dominant_color(const TinyImage *image, uint8_t *color)
The color the most pixels are closest to.
const char * tiny_format_name(TinyImageFormat format)
Retrieves the short name of a format, such as "png" or "jpeg".
int tiny_image_tint(TinyImage *image, const uint8_t *color, float strength)
Adds a color cast without touching the luminance.
int tiny_image_istransparent(const TinyImage *image)
Checks if the image has an alpha channel (transparency).
int tiny_image_crop(TinyImage *image, uint32_t x, uint32_t y, uint32_t crop_width, uint32_t crop_height)
Crops an image to the specified rectangle defined by the top-left corner (x, y) and the desired width...
int tiny_image_create(TinyImage *image, uint32_t width, uint32_t height, uint8_t channels)
Creates a new image with the specified width, height and channel count.
int tiny_image_erode(TinyImage *image, uint32_t radius)
Replaces each pixel with the darkest in a radius.
int tiny_image_arc(TinyImage *image, float degrees, const uint8_t *background)
Bends the image along an arc.
int tiny_image_shadows_highlights(TinyImage *image, float shadows, float highlights)
Recovers detail at both ends of the range.
int tiny_image_color_overlay(TinyImage *image, const uint8_t *color, float opacity)
Applies a color overlay to the image with the specified color and opacity.
TinyDrawMode
How a source image larger or smaller than its target is placed.
Definition image.h:621
@ TINYIMG_DRAW_CENTER
Definition image.h:627
@ TINYIMG_DRAW_TILE
Definition image.h:625
@ TINYIMG_DRAW_ONCE
Definition image.h:623
int tiny_image_curves(TinyImage *image, const uint8_t *x_points, const uint8_t *y_points, size_t num_points)
Applies a tone curve through the caller's control points.
int tiny_image_vline(TinyImage *image, int32_t x1, int32_t y1, int32_t x2, int32_t y2, const uint8_t *pixel)
Draws a vertical run of pixels.
int tiny_image_destroy(TinyImage *image)
Destroys an image, freeing its associated memory.
int tiny_image_pixelate_faces(TinyImage *image, uint32_t size)
Pixelates whatever the detector finds and nothing else.
int tiny_image_improve(TinyImage *image)
Applies the auto corrections a photograph usually wants together.
int tiny_image_preset(TinyImage *image, TinyImagePreset preset)
Applies a named look.
int tiny_image_has_exif(const TinyImage *image)
Checks if the image has EXIF metadata.
int tiny_display_set_transform(TinyDisplayList *list, const float *matrix)
Sets the current transform outright.
int tiny_display_rotate(TinyDisplayList *list, float degrees)
Turns the current transform.
int tiny_image_pixelate(TinyImage *image, uint32_t size)
Averages the image over square blocks.
int tiny_image_sharpen(TinyImage *image, float amount)
Applies a sharpen effect to the image.
int tiny_image_dpr(TinyImage *image, float dpr)
Scales an image by a device pixel ratio.
int tiny_image_load_scaled(TinyImage *image, const uint8_t *buffer, size_t buffer_size, uint32_t max_width, uint32_t max_height)
Loads an image at the cheapest scale that still covers the given box.
int tiny_image_fill_light(TinyImage *image, float amount)
Lifts the shadows without moving the highlights.
TinyImageFormat tiny_image_getformat(const TinyImage *image)
Retrieves the format of the image.
int tiny_image_morphology_close(TinyImage *image, uint32_t radius)
Dilates then erodes, which fills dark specks.
int tiny_image_to_rgb(TinyImage *image)
Converts the image to RGB format.
int tiny_image_dither(TinyImage *image, uint32_t levels)
Quantizes through an ordered threshold matrix.
int tiny_image_rotate(TinyImage *image, float degrees, const uint8_t *background)
Turns the image by any angle.
uint8_t * tiny_image_getdata(const TinyImage *image)
Pointer to an image's pixel data.
int tiny_image_solarize(TinyImage *image, uint8_t level)
Inverts only the channels above a level.
int tiny_image_histogram(const TinyImage *image, uint8_t channel, uint32_t *bins)
Counts how many pixels fall in each of 256 buckets.
int tiny_image_blur_region(TinyImage *image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, float sigma)
Blurs inside a rectangle only.
int tiny_image_saturation(TinyImage *image, float factor)
Adjusts the saturation of the image.
int tiny_image_clarity(TinyImage *image, float amount)
Raises local contrast, which is an unsharp mask at a large radius.
int tiny_image_channel_mixer(TinyImage *image, const float *matrix)
Rebuilds each output channel from a weighted sum of the inputs.
Options a decoder honors when only part of an image is wanted.
Definition image.h:151
uint32_t y
Definition image.h:155
uint8_t scale_den
Definition image.h:161
uint8_t effort
How much computation the decoder may spend; a TinyEffort.
Definition image.h:182
uint32_t height
Definition image.h:159
uint32_t x
Definition image.h:153
uint8_t channels
Definition image.h:163
uint32_t width
Definition image.h:157
A list of shapes that rasterizes once.
Definition image.h:1114
TinyBlendMode blend
Definition image.h:1133
uint32_t count
Definition image.h:1116
float transform[6]
Definition image.h:1126
TinyShape shapes[TINYIMG_DISPLAY_MAX_SHAPES]
Definition image.h:1118
float stack[TINYIMG_DISPLAY_MAX_DEPTH][6]
Definition image.h:1130
uint32_t culled
Definition image.h:1136
uint32_t depth
Definition image.h:1128
uint32_t points
Definition image.h:1121
uint32_t covered
Definition image.h:1138
float point[TINYIMG_DISPLAY_MAX_POINTS *2]
Definition image.h:1123
Options an encoder honors.
Definition image.h:224
uint8_t lossless
Definition image.h:228
uint8_t effort
How much computation the encoder may spend; a TinyEffort.
Definition image.h:239
uint8_t quality
Definition image.h:226
uint8_t strip_metadata
Definition image.h:232
uint8_t progressive
Definition image.h:230
What a format's header says about an image, before any pixel is decoded.
Definition image.h:119
uint8_t progressive
Definition image.h:135
TinyImageFormat format
Definition image.h:127
uint32_t frames
Definition image.h:125
uint8_t bit_depth
Definition image.h:131
uint8_t has_alpha
Definition image.h:133
uint32_t width
Definition image.h:121
uint32_t height
Definition image.h:123
uint8_t channels
Definition image.h:129
Represents an image with its width, height, and pixel data.
Definition image.h:90
TinyImageMeta * meta
Definition image.h:104
uint8_t quality
Definition image.h:98
TinyImageFormat format
Definition image.h:100
uint8_t channels
Definition image.h:96
uint32_t height
Definition image.h:94
uint8_t * data
Definition image.h:102
uint32_t width
Definition image.h:92
Definition image.h:1076
TinyShapeKind kind
Definition image.h:1078
float transform[6]
The transform in force when the shape was added, as a 2x3 affine.
Definition image.h:1098
uint32_t point_count
Definition image.h:1084
uint32_t point_first
Definition image.h:1082
TinyBlendMode blend
Definition image.h:1088
float geometry[5]
Definition image.h:1080
TinyFillRule rule
Definition image.h:1090
uint8_t color[4]
Definition image.h:1086
A grow on demand byte sink.
Definition util.h:389
Umbrella header, version and error codes.
Math shims, lookup table builders, checksums and bit level IO.