Color ramp inversion

Hello. I was wondering if any of you could tell me how to inverse the color ramp of an image. Roughly I would like to turn white to black and black to white. I can’t find that in the color manipulation tool nor in the graph builder. Thanks for your help…

Are you looking for something like that:

There you can flip your colors.

Cheers,
Andreas

It is also possible to change the colours in the sliders view. Just click on a slider.

And by clicking on the value below you can edit it.
But there is no one-click colour ramp inversion.
You can save your own inverted colour ramp and load it again later e.g. in the basic view.

2 Likes

Thank you both. Actually that looks good to me. I am going to play a bit around and see how it fits…

JP

Hi,
Is it possible to perform the color ramp inversion, or more generally a change to a predefined colour palette in a graph?

No, in a graph this is not possible.
For creating images you can use pconvert and specify a color-palette.

Ok thanks.
I use pconvert today to swap the colour palette and at the same time convert from the beam-dimap format to Geotiff. The Geotiff is then used to produce a tiled web map (slippy map) that can be viewed over the web.

However, I now want to increase the image resolution but this results in pconvert failing with an error, see below.

I think the problem is the file size becoming too large for pconvert or for the type of tiff format that pconvert can handle.
So my idea was to change the colour map and export a Geotiff/Bigtiff directly from SNAP.

The following works for smaller images but not for full resolution:

=> pconvert -f tif -c colourmap.cpd -o ./ ./S1B_IW_GRDH_1SDV_20210107T163817_20210107T163846_025051_02FB59_C685_Orb_Cal_TC_Spk_VV10.dim
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Incompatible GDAL 3.1.2 found on system. Internal GDAL 3.0.0 from distribution will be used.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.0.0 set to be used by SNAP.
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
reading file ./S1B_IW_GRDH_1SDV_20210107T163817_20210107T163846_025051_02FB59_C685_Orb_Cal_TC_Spk_VV10.dim
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.0.0 set to be used by SNAP.
INFO: org.hsqldb.persist.Logger: dataFileCache open start
loading colour palette from: /Volumes/SSD2TB/Satellit/kallsjon/colourmap.cpd
creating histogram for band ‘Sigma0_VV’…
creating RGB image…
error: failed to create image: null

Do you expect that the resulting file is bigger than 2GB?
Then this could be an issue. BigTiff is not supported as image format.
You could tailor the data to smaller chunks and create subsets.
I have provided an example graph some time ago which might serve as a starting point for you.

Maybe writing a Python script is an option for you:

It could also be a memory issue. How much RAM does your system have?

The size of one band of an uncompressed Geotiff for a “S1B_IW_GRDH_…” image at 20 m pixel spacing is 736 MB (14928 × 12335 pixels).
I expect that to be quadrupled when going to 10 m pixel spacing (29857 × 24670 pixels), i.e. approximately 2.9 GB. So yes over 2 GB.

I also tried Convert Datatype to uint8 in SNAP before saving and although the beam-dimap image becomes small the problem with pconvert persists. Maybe this could work if pconvert could export an indexed image, I think the tif format supports it.

I will try your splitting graph.

I assume the python method will have the same size problem since it makes use of pconvert.

I have 16 GB of memory on the system.