scale openexr alpha up
scale alpha up to 0 - 255 to match the rest of libvips
This commit is contained in:
parent
b92c55770f
commit
f4250ab7ab
@ -38,6 +38,8 @@
|
||||
- magickload now sniffs some file types itself
|
||||
- update radiance load from upstream
|
||||
- mapim could fail for float index images with coordinates out of int range
|
||||
- scale openexr alpha to 0 - 255
|
||||
- close input earlier, when we can [kleisauke]
|
||||
|
||||
12/3/18 started 8.6.4
|
||||
- better fitting of fonts with overhanging edges [Adrià]
|
||||
|
@ -16,6 +16,8 @@
|
||||
* - tag output as scRGB
|
||||
* 16/8/18
|
||||
* - shut down the input file as soon as we can [kleisauke]
|
||||
* 19/8/18
|
||||
* - scale alpha up to 0 - 255 to match the rest of libvips
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -332,8 +334,16 @@ vips__openexr_generate( VipsRegion *out,
|
||||
float *q = (float *) VIPS_REGION_ADDR( out,
|
||||
hit.left, hit.top + z );
|
||||
|
||||
int i;
|
||||
|
||||
ImfHalfToFloatArray( 4 * hit.width,
|
||||
(ImfHalf *) p, q );
|
||||
|
||||
/* oexr uses 0 - 1 for alpha, but vips is
|
||||
* always 0 - 255, even for scrgb images.
|
||||
*/
|
||||
for( i = 0; i < hit.width; i++ )
|
||||
q[4 * i + 3] *= 255;
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,6 +412,8 @@ vips__openexr_read( const char *filename, VipsImage *out )
|
||||
read_header( read, out );
|
||||
|
||||
for( y = 0; y < height; y++ ) {
|
||||
int i;
|
||||
|
||||
if( !ImfInputSetFrameBuffer( read->lines,
|
||||
imf_buffer - left - (top + y) * width,
|
||||
1, width ) ) {
|
||||
@ -417,6 +429,12 @@ vips__openexr_read( const char *filename, VipsImage *out )
|
||||
ImfHalfToFloatArray( 4 * width,
|
||||
(ImfHalf *) imf_buffer, vips_buffer );
|
||||
|
||||
/* oexr uses 0 - 1 for alpha, but vips is always 0 -
|
||||
* 255, even for scrgb images.
|
||||
*/
|
||||
for( i = 0; i < width; i++ )
|
||||
vips_buffer[4 * i + 3] *= 255;
|
||||
|
||||
if( vips_image_write_line( out, y,
|
||||
(VipsPel *) vips_buffer ) )
|
||||
return( -1 );
|
||||
|
Loading…
Reference in New Issue
Block a user