On 05.11.2018 16:53 FP wrote:
> Hi all,
>
> I was looking for a nice C++ GUI framework and came across FLTK.
> I am dealing with grayscale images where each pixel has a floating
> precision.
> Re-scaling such images from 0-255 is not doable since I have to combine
> them and it is important that each value keeps its original value and
> sign (there are also negative pixels).
> I am reading the documentation of FLTK but I do not seem to find a way
> to display such images from file.
Correct, there is no function to read such images in FLTK. FLTK
integrates libpng and libjpeg to read images.
> It looks like 32-bit are always interpreted as RGB, and grayscale images
> can be at most 8-bit depth.
That's correct - although 32-bit would be RGBA, and RGB is only 24-bit,
but that's probably what you meant anyway.
> Is there a way to correctly display and edit 32-bit single-channel
> images with FLTK?
Basically you can display every image you like with FLTK, as long as
each color (and alpha) channel is only 8 bits - for display.
Fl_RGB_Image uses a pixel buffer you can fill with arbitrary bits.
As said above, there is no direct method to read 32-bit per channel
grayscale images. You would have to write this yourself (or use another
library if there's one that suits your needs). I uses libtiff in one of
my applications to read tiff images, for instance. You would also have
to write your image manipulation code to combine them, as you wrote
above, but I assume this code exists already.
After doing so you could convert the resulting image to 8-bit per
channel RGB(A) or grayscale for display only if this is sufficient, but
that's something I can't tell.
ISTR that there are image manipulation programs written in FLTK that
deal with more bits per channel but I can't remember which program(s).
Maybe someone else can tell.