Skip to content

Commit 62fee01

Browse files
committed
add notes on cast and copy to arithmetic
1 parent 9f351c9 commit 62fee01

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

libvips/arithmetic/arithmetic.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
/**
5959
* SECTION: arithmetic
60-
* @short_description: operations which perform pixel arithmetic, trig, log, statistics
60+
* @short_description: pixel arithmetic, trig, log, statistics
6161
* @stability: Stable
6262
* @include: vips/vips.h
6363
*
@@ -83,6 +83,20 @@
8383
* #VIPS_FORMAT_USHORT image, and taking the vips_cos() of a
8484
* #VIPS_FORMAT_USHORT image produces #VIPS_FORMAT_FLOAT image.
8585
*
86+
* After processing, use vips_cast() and friends to take then format back down
87+
* again. vips_cast_uchar(), for example, will cast any image down to 8-bit
88+
* unsigned.
89+
*
90+
* Images have an *interpretation*: a meaning for the pixel values. With
91+
* #VIPS_INTERPRETATION_sRGB, for example, the first three bands will be
92+
* interpreted (for example, by a saver like vips_jpegsave()) as R, G and B,
93+
* with values in 0 - 255, and any fourth band will be interpreted as an
94+
* alpha channel.
95+
*
96+
* After arithmetic, you may wish to change the interpretation (for example to
97+
* save as 16-bit PNG). Use vips_copy() to change the interpretation without
98+
* changing pixels.
99+
*
86100
* For binary arithmetic operations, type promotion occurs in two stages.
87101
* First, the two input images are cast up to the smallest common format,
88102
* that is, the type with the smallest range that can represent the full

0 commit comments

Comments
 (0)