Skip to content

Commit

Permalink
tag Radiance images as scRGB
Browse files Browse the repository at this point in the history
They aren't always, but scRGB is also 0-1 range, so conveniently this
now works:

	vips copy car-stack-eighth.hdr x.jpg
  • Loading branch information
jcupitt committed Dec 13, 2012
1 parent 89ff89e commit c5a600b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions TODO
@@ -1,3 +1,5 @@
- does radiance import give 0-1 RGB images? we could tag them as scRGB

- now we've removed round-to-nearest from NN, we need something extra in the
affine transform to displace the input cods

Expand Down
7 changes: 5 additions & 2 deletions libvips/colour/rad2float.c
@@ -1,10 +1,13 @@
/* Convert Radiance 32bit packed format to float.
*
* 3/3/09
* - from LabQ2Lab and Radiance sources
* 2/11/09
* - gtkdoc
* 20/9/12
* redo as a class
* - redo as a class
* 13/12/12
* - tag output as scRGB, since it'll be 0-1
*/

/*
Expand Down Expand Up @@ -196,7 +199,7 @@ vips_rad2float_init( VipsRad2float *rad2float )
VipsColourCode *code = VIPS_COLOUR_CODE( rad2float );

colour->coding = VIPS_CODING_NONE;
colour->interpretation = VIPS_INTERPRETATION_sRGB;
colour->interpretation = VIPS_INTERPRETATION_scRGB;
colour->format = VIPS_FORMAT_FLOAT;
colour->bands = 3;

Expand Down
4 changes: 3 additions & 1 deletion libvips/foreign/radiance.c
Expand Up @@ -6,6 +6,8 @@
* - add radiance write
* 20/12/11
* - reworked as some fns ready for new-style classes
* 13/12/12
* - tag RGB rad images as scRGB
*/

/*
Expand Down Expand Up @@ -900,7 +902,7 @@ rad2vips_get_header( Read *read, FILE *fin, VipsImage *out )
vips_image_set_string( out, "rad-format", read->format );

if( strcmp( read->format, COLRFMT ) == 0 )
out->Type = VIPS_INTERPRETATION_RGB;
out->Type = VIPS_INTERPRETATION_scRGB;
else if( strcmp( read->format, CIEFMT ) == 0 )
out->Type = VIPS_INTERPRETATION_XYZ;
else
Expand Down
1 change: 1 addition & 0 deletions libvips/iofuncs/header.c
Expand Up @@ -441,6 +441,7 @@ vips_image_guess_interpretation( const VipsImage *image )
case VIPS_INTERPRETATION_CMC:
case VIPS_INTERPRETATION_LCH:
case VIPS_INTERPRETATION_sRGB:
case VIPS_INTERPRETATION_scRGB:
case VIPS_INTERPRETATION_YXY:
if( image->Bands < 3 )
sane = FALSE;
Expand Down

0 comments on commit c5a600b

Please sign in to comment.