Easily convert a hyperspectral image to an RGB image. hsi2rgb is:
- A python package that easily integrates with numpy, torch and jax, with gamma correction, batch converting, automatically formats convertions, XYZ and RGB colorspace suppots, etc.
- A docker container that can be easily deployed as a GUI application
- Install hsi2rgb
pip install hsi2rgb
- Import and use hsi2rgb
hsi = np.random.rand(144, 11, 11)
rgb = hsi2rgb(hsi) # rgb: (3, 11, 11)
- More examples can be found in test.py
An online demo is available as spaces/songyz2019/hsi2rgb
- Run the container:
docker run -it -p 7860:7860 songyz2019/hsi2rgb
- Open
http://localhost:7860
in your browser - Upload your HSI image (
.mat
or.tif
) - Set the wave length range
- Submit and see the result
Don't like docker? You can try use the GUI with pip, pipx, or uvx
# For pip:
pip install hsi2rgb_gui
hsi2rgb_gui
# For uv, run:
uvx hsi2rgb_gui
# For pipx:
pip install hsi2rgb_gui
hsi2rgb_gui
- Install uv
- Simply sync dependicies and build
cd core
uv sync
uv build
- Open the
gui
folder:cd gui
- Build the container:
docker compose build
- Run the container:
docker compose up -d
Copyright 2025 songyz2023
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.