Created
May 8, 2023 09:01
-
-
Save nvladimus/4497fd5d3019c3d9c748967b7fbda225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export your favorite Matplotlib colormap to Imaris look-up table (.pal file) | |
# Authors: ChatGPT and Nikita Vladimirov | |
# License: GPL3 | |
import matplotlib.cm as cm | |
cmap = cm.get_cmap('plasma') | |
output_file = './plasma_palette_8bit.pal' | |
with open(output_file, 'w') as f: | |
# Write the RGB values of each color in the colormap as text strings | |
for i in range(256): | |
rgba = cmap(i) | |
rgb = [int(x * 255) for x in rgba[:3]] | |
f.write(f'{rgb[0]:.3f} {rgb[1]:.3f} {rgb[2]:.3f}\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment