Java code to convert 8 bit images to 16 bit image

Hi Everyone,
Requirement: The folder has a bunch of 8-bit images in a pattern. Grouping the images and then save the images as a 16-bit TIF image.
For grouping the images and converting the format, I can use the bfconverter tool cmd line tool (Looking for ways to group and merge the channels from the list of files (group files with similar names)). The convertor tool doesn’t provide the option to convert from 8 bit to 16-bit (I believe?)

Input Files list: All in 8 bits
DsRed30KD_6.2.19_Mark_and_Find 001_Position049_z0_ch00.tif
DsRed30KD_6.2.19_Mark_and_Find 001_Position049_z0_ch01.tif
DsRed30KD_6.2.19_Mark_and_Find 001_Position049_z1_ch00.tif
DsRed30KD_6.2.19_Mark_and_Find 001_Position049_z1_ch01.tif
DsRed30KD_6.2.19_Mark_and_Find 001_Position049_z2_ch00.tif
DsRed30KD_6.2.19_Mark_and_Find 001_Position049_z2_ch01.tif

Desired output File: in 16 bit and the images are grouped by Z and Channel pattern:

Please check if you could answer the following questions:

  1. How to convert the 8-bit images to 16-bit images using Java code? For now, I am looking for the solution without using macro
  2. Can you suggest to me the efficient way to perform this whole process (Grouping images and converting the bits using Image reader and writer? rather than using bfconverter tool for grouping and changing the format and then converting the bits

For others viewing this thread, there is related ongoing discussion in Looking for ways to group and merge the channels from the list of files (group files with similar names) - #19 by s.besson

1 Like