javatiffgeotools

how to create rgbstyle while rendering tif file using geotools?


I have a tiff file, and the effect when opened in qgis is very inconsistent with the effect rendered with geotools.

open by qgis enter image description here

the imagelab snapshot (Color is obviously distorted). enter image description here the Imagelab source code can be download from here: https://docs.geotools.org/stable/userguide/_downloads/b1a328d258da28a4e9da534d4aaca37c/ImageLab.java The key code is the createRGBStyle function, the code has some compilation errors, mainly namespace issues. I will put the modified code in the link below.

The strange thing is that some tiff files have normal effects after being opened with imagelab. what is the reason behind the scene?

the source tiff file and modified imagelabs

geotools's version: 28.5,29.3,30.1

I used qgis to view the metadata information of the two tiff data and found nothing special. geotools imagelab render with color error tiff geotools render error tiff geotools imagelab render ok tiff geotools render ok tiff


Solution

  • The cause of the problem was found. It was caused by the tiff file not generating an image pyramid. It should also be noted that when generating an image pyramid, you need to use the external mode, which is to generate the external pyramid file of ovr. Otherwise, there will still be problems when rendering with geotools. . Finally, geotools still has some problems when rendering tiff pyramid images. After zooming in to a certain extent, the color will be distorted.