For input images in float format, input pixels with alpha=0 have no effect, and output pixels which haveĪlpha=0 will be 0 in all channels. However, this is only true for input images In which case the result for that pixel is the same as it would be without FLAG_ALPHA_PREMULTIPLIED. Input pixels which haveĪlpha=0 do not contribute at all to output pixels unless all of the input pixels affecting that output pixel have alpha=0,
If you linearly filter non-premultiplied alpha, strange effects occur.
#Stbimage image example java lwjgl movie#
While premultiplied alpha is standard in the movie CGI industry, it is still uncommon in the videogame/real-time If you use premultiplied alpha, linear filtering (such as image resampling done by this library, or performed in texture units on The best mathematically-behaved version of alpha to use is called "premultiplied alpha", in which the other color channels have had the alpha value.Most of the resizing functions provide the ability to control how the alpha channel of an image is processed. Num_channels, alpha_chan, 0, STBIR_EDGE_CLAMP) Stbir_resize_uint8_srgb( input_pixels, in_w, in_h, 0, Output_pixels, out_w, out_h, 0, num_channels) Stbir_resize_uint8( input_pixels, in_w, in_h, 0,
Easy API downsamples w/Mitchell filter, upsamples w/cubic interpolation. Scaling and translation is supported, no rotations or shears. (No SIMD or threads, so it be easily outperformed by libs that use those.) Only Written with emphasis on usability, portability, and efficiency. Native bindings to stb_image_resize.h from the stb library.