diff --git a/vips.h b/vips.h index 371de43..c3f7d9e 100644 --- a/vips.h +++ b/vips.h @@ -283,6 +283,12 @@ vips_is_16bit (VipsInterpretation interpretation) { int vips_flatten_background_brigde(VipsImage *in, VipsImage **out, double r, double g, double b) { + if (vips_is_16bit(in->Type)) { + r = 65535 * r / 255; + g = 65535 * g / 255; + b = 65535 * b / 255; + } + double background[3] = {r, g, b}; VipsArrayDouble *vipsBackground = vips_array_double_new(background, 3);