The use case I'm investigating is to read a an input image (tif), modify it and write it to an output image (tif) .
I'm looking for a convenient way to ensure that the writer uses the same compression settings etc as the original image. I haven't found a convenient way to achieve this with ImageIO (with JAI plugin) . I tried probing the imageReader.getDefaultReadParam() but it doesn't contain anything of note. The imageReader.getImageMetadata(...) contains info deep inside but the data structure organization is hopeless.
My fallback approach at this time is to use Apache Commons to detect the compression (eg. Imaging.getImageInfo(inputFile).getCompressionAlgorithm()) and logically set the writer compression parameter in ImageIO.
Is there a more elegant way to accomplish this without having to jump through this hoop ?
As an aside, I can't use Apache Commons Imaging exclusively for our image processing task because it doesn't yet completely support some other formats I need eg. writing jpg
Thanks