Karoshi MSX Community
28 de Enero de 2021, 06:29:58 am *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
   Inicio   Ayuda Buscar Ingresar Registrarse  
Páginas: [1]
Autor Tema: Quick'n'Dirty GIMP BMP -> MSX (sc5, sc6)  (Leído 4618 veces)
0 Usuarios y 1 Visitante están viendo este tema.
Karoshi Forum's Guru
Mensajes: 1812

« : 12 de Octubre de 2010, 01:33:01 pm »

Please read this first:

- This tiny program does not implement full BMP format
- It will only work in BMP files saved by GIMP program with 16 colours and no RLE compression
- The resulting PAL and PAT files are the palette and pattern raw data in MSX format, but they have no heading
- Compile using GCC: gcc bmp2msx.c -obmp2msx
- Probably it will work also in Windows/Mac with GIMP files, but it hasn't been tested
- This code is pure crap, I know it, so don't bother to comment it aloud Wink

// BMP -> raw SCREEN 5/6 converter (palette and pattern files)
// Eduardo Robsy Petrus, 2010
// v.0.1
// Use with GIMP BMP files with 16 colours and no RLE compression
// Make sure that the image has even pixel width


FILE *input,*output;
int i,j,x,y,k;
unsigned char buffer[1024*128];

int main(int argc, char *argv[])


// Print tool name
 printf("BMP2MSX v.0.1 - converts GIMP 16-colour BMP to MSX Screen 5/6\n");

// Check if there is a filename parameter
 if (argc!=2)
// If not, print brief instructions
  printf("Usage: bmp2msx [file.bmp]\n");
  return 0;

// Try to open the file
 if ((input=fopen(argv[1],"r"))==NULL)
  printf("Cannot open %s\n",argv[1]);
  return 1;

// Read all file to buffer
 for (i=0;!feof(input);buffer[i++]=fgetc(input));

// Create palette file
 for (i=0;i<16;i++)

// Create pattern file
 printf("%i x %i pixels\n",x,y);

 for (j=y-1;j>=0;j--)
 for (i=0;i<x;i++)



A very easy process to convert images:

- Open/Edit the image in GIMP
- Convert to indexed image (image > mode > indexed), set 16 as maximum colours and enable dithering if you need it
- Save as BMP file with no RLE compression
- Use the provided command-line tool to convert it easily
- Generate the required code to render the image back in MSX!
« Última modificación: 13 de Octubre de 2010, 10:54:38 am por pitpan » En línea
Páginas: [1]
Ir a:  

Impulsado por MySQL Impulsado por PHP Powered by SMF 1.1.21 | SMF © 2013, Simple Machines XHTML 1.0 válido! CSS válido!