Code Monkey home page Code Monkey logo

retropixels's Introduction

retropixels

Convert images to Commodore 64 format.

Input Output

This is intended primarily for:

  • Commodore 64 developers who want to convert an image to graphics data for use in a Commodore 64 production.
  • Commodore 64 pixel artists who want to use an existing image as a starting point.
  • People who like the Commodore 64 graphics esthetics and want to apply them to an image.

You can use retropixels:

retropixels's People

Contributors

dependabot[bot] avatar micheldebree avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

retropixels's Issues

Developer friendly NPM package

Retropixels as a library is not developer friendly to use. It is not clear how to import the different classes. It is also not documented.
Todo:

Make sure classes can be imported the usual way, f.e.

import {Converter} from 'retropixels';

Documentation is out of scope.

Output as VICE monitor command file

Output picture as a file that can be sourced straight into the VICE remote monitor.
Outputting multiple frames can use VICE as a canvas for animations.

Option to force background color

I want to be able to specify which color is the background.
Specify a color from the palette, user has to figure out to which palette color the color in the original is mapped.
Easiest is to use black in the original, and specify 0 as background color.

Move ordered dithering to pre-process step.

Ordered dithering can be done on the (scaled) source image once, and does not need to be incorporated in the retropixels classes.

  • Dither the scaled source image
  • Remove any ordered dithering from the actual retropixel classes.

Support more Bayer matrix dithering modes

The default is now (0.2.1) pretty crappy. One should be able to choose:

  • The matrix size (none, 2x2, 4x4, 8x8)
  • The threshold depth

Also, a sensible default that looks good.
And precalculation of matrices to speed up things.

Improve performance of quantizing

There is a lot of quantizing going on, which is a bottleneck for performance. To improve this:

  • Assume there is only one palette being used in the image (no different palettes per colormap)
  • Convert palette to the chosen colorspace only once.
  • Generally avoid quantizing the same pixel more than once.

Split into core library and cli tool

  • Cli tool has library as dependency
  • Move file io to Cli tool (c64writer, Jimppreprocessor)
  • No dependencies should be left because all dependencies have to do with file io
  • Split c64writer into c64 file format (lib) and actual writing to file (cli)

Command line interface

Add a simple command line interface to convert a picture to a koala pic. Code should be documented to serve as an example on how to use the library.

Separate source and build artefacts

  • Do not install source as part of global retropixels command
  • Remove source from docker image after build

The compiled c64 code should be moved to target folder.

Support fake c64 modes

Fake (impossible) modes which are not limited by attribute maps (only by palette and resolution). With these modes you can make c64-like images that look better because they don't suffer from color bleeding, but are actually not possible on a real c64.

  • c64MulticolorFake
  • c64HiresFake

Use cases:

  • Retro styling without color bleeding artifacts, for use outside of the c64 world
  • Better visuals/performance when retrostyling video

Support for FLI profi

See https://csdb.dk/release/?id=12671

This Editor enables you to draw in the first 3 chars of a FLI picture using several sprite colors, lt. grey, $d021 and one extra color per line of your own choosing (Hooray for illegal opcodes & speedcode!)

So:

  • 1 sprite wide, stacked horizontally
  • 3 colors:
  • background color
  • grey for all sprites (?)
  • one custom color per rasterline

Batch conversion

This is an amazing utility and I use it to create my own custom "Nuvies" (https://www.youtube.com/watch?v=b2pP2DoG93E), however, it takes a while to create the KLA file for each frame and I was wondering there could be a batch option implemented where it takes a folder of PNG files and automatically creates the related KLA files? Thanks!

Sprite modes

Hires sprite (24 * 21 pixels * 1 colors + 1 transparent)
Multicolor sprite (12 * 21 pixels * 3 colors + 1 transparent)

Export to PNG with transparency?

Package as library

  • Test how to use npm package as a library as opposed to cli tool
  • Optionally refactor if it is not suited yet

Explicitly set output format

Add an option for output format and remove determining the format from the file extension.
Because an output extension could support multiple formats in the future.

--format

Values:

  • koala
  • spritepad
  • png
  • prg

Specific formats to add:

  • fli
  • afli
  • hires

Default:

  • png?
  • extensions: 'kla', 'spd', 'png', 'prg'
  • when no output file is given, use the input file with the new extension

No dithering on unrestricted images

When using unrestricted (fake) modes, ordered dithering doesn't seem to work.
Because an unrestricted image is used for optimizing colormaps, this could lead to some inaccuracy (?).

Fix:

  • save the unrestricted image used for optimizing colormaps
  • See if dithering occurs
  • If not, find out why dithering was not applied and fix.

Multicolor PNG output is not scaled pixel perfect

Multicolor PNGs are scaled from 160x200 pixels to 320x200 pixels. Pixels should become double width, but colors are interpolated instead, resulting in different colors for one 'double' pixel.

Probably need to tell the scaling algorithm to use 'nearest neighbour'

Error when running on Ubuntu

I've installed git and yarn, and NodeJS (v8.10), and I've installed RetroPixels via npm, and it doesn't give me any errors during installation. However, when I run it, I get the following errors I can't interpret:

/usr/local/lib/node_modules/retropixels/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^

SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/retropixels/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

Any ideas about what I need to install? I don't recognize any of this stuff.

Greg.

Reject input files that are too small

If --scale none is used, input files that are smaller that the output dimensions cause an error.
Pad with black to make them fit.
Reject the input file. This way the user has to decide which color is the background color.

User can move the cropping window

When the image is cropped, allow the user to freely move the cropping window over the picture.
This should also be easy to do with pixel-perfect resolution, to try and minimize artifacts in parts of the picture.

For example, dragging in the input window with the mouse, and/or moving pixel-by-pixel with cursor keys.

N.B. Do this after #63

FLI colormaps not optimized enough

Colormaps with lower resolution should come first in colormap optimization, but the $d800 colormap comes last. Changing the order messes up the bitmap in the exported FLI.

Solution:
Map the PixelImage index (index to the ColorMaps) to the c64 bitmap index. It is now implicit from the order of the ColorMaps. Making an explicit mapping decouples the order of the ColorMaps to the pixel indexes in the FLI bitmap.

FLI bug not visible in PNG export

The FLI bug affecting PRG export is not visible in PNG. This means the PNG does not represent the 'real' result on a Commodore 64, which it should.

Fix: Clear leftmost 3 characters in index and colormaps for FLI mode.

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.