TIFF creation: compression and band ordering


I was wondering if its possible to activate the tiff lossless compression and change the order of the bands. Right now we are interested to have the created tiff in BGR order instead or RGB. So the metadata of tiff would have to be changed as well.
We can of course change the order by exchanging the blue and red channel before the tiff creation but the tiff metadata is not changed accordingly obviously. Is there any way of doing that by activating a flag or something ?
This is useful for us for our remote sensing application since we want the bands to appear from the shortest to the highest wavelength.

Thanks in advance.



Alright thank you. So no easy

Alright thank you. So no easy way except using an external library then. Also I wanted to ask. What exactly is the difference between the RawProcessor.imgdata.image pointer obtained after dcraw_process() and dcraw_make_mem_image(). Is there a memory copy done or is it the same pointer ?

Thanks again for the

Thanks again for the information. So except for the difference in size in one case the gamma correction and some other processes occurs when the tiff is created (with dcraw_process() ) and dcraw_make_mem_image() really produces the final processed pixel data.

image[][4] is used for both

image[][4] is used for both intermediate results and for final result.
After dcraw_proces() is called,
image[i][0..2] contains final image in 16-bit and in linear space for i-th pixel
image[i][3] contains some garbage (not used intermediate results, etc).

Also, image[] is not rotated (if rotation is set via metadata or via user_flip)

make_mem_image prepares final result: 3 components per pixel, gamma corrected (according to imgdata.params.gamm[]), 8 or 16 bit (according to params.output_bps)

-- Alex Tutubalin @LibRaw LLC