Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I have a b&w UInt8 image (in.png) and a colormap with 256 ordered colors (colormap.png). I want to recolor the b&w image according to the colormap. I'm very happy with:
but I was wondering if it wouldn't be a lot faster to just switch the internal colormap of an indexed image from the black and white one to the desired colormap. My understanding of how this would work might be completely wrong... I would want for a pixel that has a value of UInt8(0) to get the first color in the colormap, a pixel with a value of UInt8(1) to get the second color in the colormap, etc... No interpolation, dithering, or stuff like that.
I see. That's too bad. It would make sense to have some functionality like that in imagemagick for indexed images. Should be super fast regardless of the size of the image (but I guess that the size of the colormap should matter).
Yes, it would be quick, as pixels wouldn't need to be read or written (just the bytes copied from input to output).
ImageMagick is really an image processor, so it doesn't have many command-line options for manipulating lower-level constructs like colormaps, other than "-cycle".
You can convert your color table to an image, with one pixel per color. Then use -remap to recolor the image so that it is using only those colors, which should then go into the image's colormap. See http://www.imagemagick.org/Usage/quantize/#remap
"-remap" finds for each pixel the closest colour in the map image. By contrast, "-clut" (or somehow changing the colormap) can change any colours to any other colours, which is what I think yakir wants.
It seems that Mathlab has tools for changing colormaps. I don't know if this would be faster than ImageMagic's "-clut". There may be specific tools for colourmaps in specific formats such as PNG or TIFF