clip negatives off LABS L in tiff save
Negative L in LABS needs to be trimmed off before savingf as TIFF. Thanks angelmixu. See https://github.com/libvips/libvips/issues/1499
This commit is contained in:
parent
e236f19f97
commit
6fea2e7c57
|
@ -1235,16 +1235,18 @@ invert_band0( Wtiff *wtiff, VipsPel *q, VipsPel *p, int n )
|
||||||
static void
|
static void
|
||||||
LabS2Lab16( VipsPel *q, VipsPel *p, int n, int samples_per_pixel )
|
LabS2Lab16( VipsPel *q, VipsPel *p, int n, int samples_per_pixel )
|
||||||
{
|
{
|
||||||
int x;
|
|
||||||
short *p1 = (short *) p;
|
short *p1 = (short *) p;
|
||||||
unsigned short *q1 = (unsigned short *) q;
|
unsigned short *q1 = (unsigned short *) q;
|
||||||
|
|
||||||
|
int x;
|
||||||
|
|
||||||
for( x = 0; x < n; x++ ) {
|
for( x = 0; x < n; x++ ) {
|
||||||
|
int v;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* TIFF uses unsigned 16 bit ... move zero, scale up L.
|
/* LABS L can be negative.
|
||||||
*/
|
*/
|
||||||
q1[0] = VIPS_LSHIFT_INT( (int) p1[0], 1 );
|
q1[0] = VIPS_LSHIFT_INT( VIPS_MAX( 0, p1[0] ), 1 );
|
||||||
|
|
||||||
for( i = 1; i < samples_per_pixel; i++ )
|
for( i = 1; i < samples_per_pixel; i++ )
|
||||||
q1[i] = p1[i];
|
q1[i] = p1[i];
|
||||||
|
|
Loading…
Reference in New Issue