You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been writing some scripts in the nip2 scripting language to deal with b&w film scans. Those are in 16bit greyscale.
I load it into a nip2 workspace, nip2 says it is "3424x2320 16bit unsigned integer, 1 band, GREY16"
Then I run it through a toolkit I wrote, which does some manipulation (gamma + scaling), which is inherently a floating point operation, so no surprise that the results of that nip2 cell says the image is now: "3424x2320 32bit float, 1 band, GREY16"
However, this is problematic since some of nip2 tools don't work properly on 32bit float images.
In my script, I tried to do conversion : value = colour_transform_to Image_type.GREY16 value2; where value2 is the manipulated image as before (I did reload the script in the meantime). This conversion does not seem to change anything, as the type of the image in the nip2 cell is still declared as "3424x2320 32bit float, 1 band, GREY16".
I also tried to do casts, which also brought nothing.
Is there a bug in the color_transform_to function, or (more likely) am I misunderstanding something here? I'm using nip2 v 8.7.1 compiled against libvips 8.8.3 on a linux machine.
Greetings,
Indriði
The text was updated successfully, but these errors were encountered:
indridieinarsson
changed the title
Confusion with image format conversion
colour_transform_to Image_type.GREY16 leaves image as 32bit float
Nov 1, 2019
This is deliberate: tags like grey16 say how pixel values should be interpreted, not what exact numeric format they are. grey16 just means values in the range 0 - 65535 (2 ** 16 - 1) are black to white, and there's a linear gamma.
If you want a 16-bit numeric format, use (unsigned short) A3 or cast_unsigned_short A3 or Image / Format / 16-bit unsigned.
I've been writing some scripts in the nip2 scripting language to deal with b&w film scans. Those are in 16bit greyscale.
I load it into a nip2 workspace, nip2 says it is
"3424x2320 16bit unsigned integer, 1 band, GREY16"
Then I run it through a toolkit I wrote, which does some manipulation (gamma + scaling), which is inherently a floating point operation, so no surprise that the results of that nip2 cell says the image is now:
"3424x2320 32bit float, 1 band, GREY16"
However, this is problematic since some of nip2 tools don't work properly on 32bit float images.
In my script, I tried to do conversion :
value = colour_transform_to Image_type.GREY16 value2;
wherevalue2
is the manipulated image as before (I did reload the script in the meantime). This conversion does not seem to change anything, as the type of the image in the nip2 cell is still declared as"3424x2320 32bit float, 1 band, GREY16"
.I also tried to do casts, which also brought nothing.
Is there a bug in the color_transform_to function, or (more likely) am I misunderstanding something here? I'm using nip2 v 8.7.1 compiled against libvips 8.8.3 on a linux machine.
Greetings,
Indriði
The text was updated successfully, but these errors were encountered: