MSX Palettes for the GIMP and Photoshop
By FRS, v1.3
License: CC BY-SA

1) Overview

These are the MSX palettes for the GIMP and Photoshop. They can be used with
any image editors that are compatible with these formats

2) Revelant technical details

a) About the formats:
- .gpl: is the GIMP text-format palette file. Used by the GIMP and other
  image editors like Aseprite or Krita. The matrix dimensions to show each
  palette are automatically configured inside the file.
- .act: is the Photoshop binary format palette file. Weirdly enough, the GIMP
  uses this format only for its Raw Image Data importer feature. On Photoshop,
  organize the colors as a matrix with the following dimensions:
  - MSX1/TMS992x and MSX2_default: 8x2
  - SCREEN8: 32x8
  - SCREEN10: 16x4096
  - SCREEN12: 32x4096
- PNG: These are the palettes rendered as an imge with a single color per pixel,
  to be used as a color picker. The PNG files with 256 colors or less are also
  indexed color images, with the embedded palette with the correct indexes.

b) It's important to keep the colors in the original sequence, since their
indexes are relevant, otherwise there will be the following issues:

- The following GIMP features won't work correctly:
  - Colors->Map->Set Color Map function
  - Import .SC8 or .SC12 images using File->Open->raw image data
- A real MSX will render the colors incorrectly if they're out of order.
  I.e, if you export a .BMP file to be read by the MSX, or to convert
  to .MAG using MG.EXE (in this case, the MAG platform-specific header fields
  need to be corrected for MSX values)
- The SCREEN10 and SCREEN12 palettes are organized in columns, so each of their
  rows have all the colors that are allowed to share the same 4x1 cell on the
  image. This is a technical restriction of these two modes. Check the
  recommended reading chapter ahead, for more details.

c) The palettes use linear values just like the real MSX. No gamma factor is
pre-cooked. If you need to add CRT gamma correction, the correct way to do this
is to attach a color profile to your image that will remap the levels
accordingly.

3) Additional information

The MSX pixels are not square, but in fact slightly rectangular. 
Its Pixel Aspect Ratio (PAR) is 1.138, or roughtly 7:5.

To setup this on the GIMP, follow the following steps. It needs to be
configured per-image, and will be embedded as metadata when you export a PNG
image file, so it can be correctly rendered by viewers that support Pixel
Aspect Ratio.
(Should also be exported on GIF files, but the GIMP still doesn't support it.
:facepalm:)

- Select the menu Image->Print Size
  - Click on the "chain link" icon to unlink the X and Y resolutions
  - Configure the following values in pixels/in:
    - SCREENs 2 to 5 and 8 to 12 (256x212p). Also 6i and 7i (512x424i): X=24.604 and Y=28
    - SCREENs 6 and 7 (512x212p): X=49.209 and Y=28
- Select the menu View and disable the option "Dot for Dot". This will enable
  the non-square pixel support on GIMP

There's a similar procedure on Photoshop, but you'll have to google for a
tutorial on how to set it up.

4) List of palettes:

- README1st.txt			: This README file
- MSX1_TMS992x_half_saturation	: MSX1 with the TMS992x VDP configured for 50% saturation. It's the default saturation of the majority of MSX1 models that use the TMS992x VDP
- MSX2_default			: Default MSX2 palette, setup on boot
- MSX2_SCR8			: MSX2 SCREEN8 background palette
- MSX2_SCR8-sprites		: MSX2 SCREEN8 sprites palette. Details here: https://www.msx.org/wiki/The_OR_Color#Sprites_on_screen-8
- MSX2+_SCR10			: MSX2+ SCREEN10 YJK colors palette. Sadly, GIMP still doesn't support such a huge palette properly
- MSX2+_SCR12			: MSX2+ SCREEN12 YJK colors palette. Sadly, GIMP still doesn't support such a huge palette properly
- MSX2+_SCR12grayscale		: MSX2+ SCREEN12 YJK colors mapped as grayscale. Used on Photoshop or GIMP to import .SCC images as raw image data, so they can be exported to BMP with the correct indexes, for conversion to .MAG

5) Recommended reading

https://en.wikipedia.org/wiki/Attribute_clash

- SCREEN2 & SCREEN4 color clash and how to draw: 
  - https://www.msxblog.es/dibujar-en-screen-2-con-photoshop/
  - https://www.msxblog.es/tecnicas-para-pintar-imagenes-en-screen-2-1-parte/

- SCREEN10 & SCREEN12 color clash and how to draw:
  - https://map.grauw.nl/articles/yjk/
