Magick swirl.jpg dither -remap cga16.gif resultIM.pngÄoubtless the code could be converted for EGA, VGA and the other early PC hardware palettes. from PIL import Image oldimage Image.open ('oldimage. # Remap colours in "swirl.jpg" to the CGA palette That creates this 16x1 swatch (enlarged so you can see it): In the case of library I got much faster conversion speed: 900 ms for tiff format 2500 ms for gif format. There are 256 distinct colors in the resulting palette, that is perfect for me. Xc:'#AA0000' xc:'#AA00AA' xc:'#AA5500' xc:'#AAAAAA' \ Yes it is possible, and very easy to do: Image > Mode > Indexed Color: Here you can switch the Palette to 'Custom', pick number of colors in the palette and few other options. Or, if you don't really want to write any Python, you can do it on the command-line with ImageMagick in a highly analogous way: # Create 16-colour CGA swatch in file "cga16.gif" Res = im.quantize(colors=len(CGAcolours), palette=CGA, dither=) # Quantize to our lovely CGA palette, without dithering # Make a CGA palette and push it into image Basically you would create a 24x1 image, called 'map.png', with one pixel of each colour in your palette, and tell ImageMagick to remap your lion image to that colormap in the Lab colourspace without dithering. It is installed on most Linux distros and is available for macOS and Windows. Here's one way to do it with PIL - you may want to check I have transcribed the list of colours accurately from here:: #!/usr/bin/env python3 ImageMagick can do this much faster, if speed is the issue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |