CoolMiniOrNot Forums - Mapping image to paints tutorial
  • Mapping image to paints tutorial

    I created a small CAP (computer aided painting) tutorial on how to find out which colors should I use to reproduce a given image.

    For this I used three tools.

    Paint Color Comparison Chart by Scott Sobieraj
    Vim for Windows free text editor
    Gimp for Windows free image editor

    If you did not do so far, please download and install them.

    Furthermore download and unzip the attached C2Pplugin.vim.zip file.

    1. Download the Paint Color Comparison Chart in a manageable format

    Open Paint Color Comparison Chart in your favorite browser
    In Google Spreadsheet: File | Download as | Web Page (.html, zipped)
    unzip to a desirable location

    2. Generate color mapping

    Open vim and the paint range

    Open vim, on Windows you can access it at Start | All Apps | Vim 8.0 | Vim

    For beginners, the most important command is
    Code:
    :q!
    which will exit from vim without any changes.

    If you made a mistake, press 'Esc' a couple of times, then pressing 'u' will undo the changes made so far.

    Furthermore with right mouse click you can paste selected commands into vim.

    So if you do not wish to type much, just copy the CODE snippets below, and with right click paste them one by one into vim. Finally press 'Enter', as the command buffer (the line on the bottom) is not executed all the time.

    Load the attached vim functions

    Code:
    :source DOWNLOAD_PATH/C2Pplugin.vim
    Convert the paint range

    Open the html sheet of a given paint range (please replace DOWNLOAD_PATH with the location of the Paint Color Comparison Chart):

    Code:
    :e DOWNLOAD_PATH/Paint Color Comparison Chart/Vallejo Model Color.html
    To extract the important data from this table, call the following function:

    Code:
    :call C2PCreatePaletteData()
    The file should look something like this:

    Code:
    1 70.951 255 255 255 White
    2 70.820 239 238 226 Offwhite
    3 70.918 239 241 217 Ivory
    4 70.928 254 237 208 Light Flesh
    5 70.837 209 196 156 Pale Sand
    6 70.917 219 197 142 Beige
    ...
    If yours look similar, it is time to backup all the results so far:

    Code:
    :w! vmc_palette.txt
    File will be generated to C:/Users/USERNAME/

    3. Create the GIMP palette

    The user's GIMP palette can be found in C:/Users/USERNAME/.gimp-2.8/palettes/, we will add ours there

    Create the GIMP palette file and add header:

    From this palette data file we can generate the GIMP palette:

    Code:
    :call C2PCreateGimpPalette('VMC')
    After starting GIMP, we can use this palette.

    4. Converting Image in GIMP

    Export image

    I used a Bloodletter image from http://warhammer40k.wikia.com . For this tutorial I shrinked it by a factor of 10.

    So the input image will be:



    GIMP is used to convert an RGB image (representing the colors you can see with your eyes) to indexed image (representing the paints you have)

    File | Open...
    Image | Mode | Use Custom Palette: VMC | Dithering: Floyd-Steinberg (Remove unused colors from colormap should be turned off!!!) | Convert
    File | Export as | HTML table

    The dithered image looked like this:



    This HTML page is unusable, though, contains only color indices and needs some conversion to display the paints and colors correctly.

    5. Create a digestable HTML page

    Open the html image in vim

    Code:
    :e DOWNLOAD_PATH/HTML_IMAGE_NAME.html
    Convert the colors to paint description

    Pick your favorite palette file, in this case vmc_palette.txt and apply to the HTML file

    Code:
    :call C2PReplacePalette('vmc_palette.txt')
    :w!
    Feel free to open in your favorite browser, and hover over a given cell to display it's paint.

    The result should look something like this:

    Comments 1 Comment
    1. gorb's Avatar
      gorb -
      Thanks for the write-up! This looks interesting, I'll give it a go.
  •  Articles order

    sort by Set Ascending

    Recent Articles


Privacy Policy  |   Terms and Conditions  |   Contact Us  |   The Legion


Copyright © 2001-2018 CMON Inc.

-->