please, is there a way to save a 2D array of integers as a .png image, where for each integer value in the array I associate a certain color in the output image?
I am looking for a solution for https://en.wikipedia.org/wiki/Indexed_color
Ideally, something like
imwrite(myArray, myMap, ‘myfile.png’)
Background of my application: I classify pixels in an image in a set of predefined categories and I would like to save the resulting image with a different color to represent each category. For now, what I was able to do in Julia was
save(File(format"PNG", “myfile.png”), colorview(Gray, myArray/nclasses)), this generates grayscale images
Please, do you have some hints?
Thank you in advance for your time,