Giter Club home page Giter Club logo

gimpfu-msx-gr4.py's Introduction

gimpfu-msx-gr4.py

Options dialog

GIMP script to export bitmap as GRAPHICS 4 file (a.k.a. "SCREEN 5"). GRAPHICS 4 specs are:

  • 4 pages;
  • 256x1024 image (256 per page) with a 256x212 or 256x192 viewport;
  • 16 color palette (from 512);
  • sprite mode 2;

Plug-in is accessible through Filters > MSX >> Export GRAPHICS 4 bitmap. You may disable Image Encoding altogether to create an image inside GIMP and not export it to disk at all. In this case, the plug-in doesn't check image size. But be warned: big images tend to take a very. Long. Time.

Meaning of input fields

  • Input transparent color: if the source image doesn't have any transparency, consider this colour the transparent colour when converting image to the MSX (index 0). This requires "Reserve index 0 as transparency" to be active.
  • Reserve index 0 as transparency: the plugin can optionally use the colour index 0 as a normal colour and improve dithering a little bit if you disable this.
  • Image encoding: common MSX image formats the plugin recognises.

Latest changes

  • The plugin now detects if a predefined transparent colour is being used and force it to index 0. "Reserve index 0 as transparency" must be activated.
  • The plugin now uses the alpha channel of RGBA images as transparent colour automatically (second option in the filter menu).

Original vs sample image

As usual, here is a picture of a good girl for comparison:

Original image Sample image

Installation:

  • Change permission to execute the file:
    • chmod +x gimpfu_msx_g4.py
  • Put the file into your GIMP plugin directory:
    • if you installed GIMP as a normal package, it's ~/.config/GIMP/2.10/plug-ins/;
    • if you installed GIMP as a flatpak package, it's ~/.var/app/org.gimp.GIMP/config/GIMP/2.10/plug-ins/;
  • Restart GIMP

Loading SC5 files

You may load files created by this plug-in using this simple code in BASIC:

10 SCREEN 5
20 REM use line below if transparency is disabled
30 VDP(9)=VDP(9) OR &H20
40 BLOAD"NONAME.SC5",S
50 COLOR=RESTORE
60 IF INKEY$ = "" GOTO 60

File (NONAME.SC5) contains the pattern and palette data. If image height is 237 pixels or more, the palette data will overwrite the pattern data. It's recommended to use SR5 with a separate palette file in this case.

Loading SR5 files

Loading SR5 files is just a little different in BASIC:

10 SCREEN 5
20 REM use line below if transparency is disabled
30 VDP(9)=VDP(9) OR &H20
40 BLOAD"NONAME.PAL",S
50 COLOR=RESTORE
60 BLOAD"NONAME.SR5",S
70 IF INKEY$ = "" GOTO 70

The first file (NONAME.PAL) is the palette and the second file (NONAME.SR5) is the pattern data and you need both to get the right image.

Loading DAT files

DAT (DATA) files are copies of portions of the screen dumped to a disk file. They are created by MSX-BASIC COPY command and are limited to a maximum of 212 pixels height. Loading DAT files in BASIC is easy:

10 SCREEN 5
20 REM use line below if transparency is disabled
30 VDP(9)=VDP(9) OR &H20
40 BLOAD"NONAME.PAL",S
50 COLOR=RESTORE
60 COPY "NONAME.DAT" TO (0,0), 0
70 IF INKEY$ = "" GOTO 70

A palette file (NONAME.PAL) is still recommended to restore the image properly.

TODO

  • ordered dithering;
  • make it faster (dithering is very slow and stupidly unoptimised);
  • enable or disable transparent colour;
  • palette export;
  • RGB to indexed conversion;
  • export raw file to be used by external compressors;
  • ignore alpha channel instead of triggering errors;
  • embedded palette support;
  • MSX-BASIC COPY to disk format support;
  • enable user to define the transparent colour;
  • RLE encoding;
  • aPLib compression;
  • converting layers into pages;

gimpfu-msx-gr4.py's People

Contributors

pvmm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gimpfu-msx-gr4.py's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.