Jump to content
IGNORED

RGB to Atari colors


Recommended Posts

Does anyone know of a good program for converting RGB values to the closest Atari palette COL/LUM values?

Thanks.

--Selgus

I know someone posted a formula for this a while back but I cannot remember where. I seem to recall it had to do with emulator pallettes. I'll see if I can dig it up.

 

Stephen Anerson

Link to comment
Share on other sites

I used something way back when on this thread: Post #5

 

Possibly the emulator code may have been updated since then, and also 'other' palettes can be used instead or the code rebuilt with a different 'colshift' value. But anyway, here is the code and a windows built binary that may help. Example below:

 

D:\Work>cl rgb2a8.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

rgb2a8.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:rgb2a8.exe
rgb2a8.obj

D:\Work>rgb2a8
Format:rgb2a8 Red Green Bluen(values between 0 and 255)

D:\Work>rgb2a8 255 255 255
R=255 G=255 B=255 : $0F Hue = 0 Lum = 15

D:\Work>rgb2a8 255 0 0
R=255 G=  0 B=  0 : $36 Hue = 3 Lum = 6

D:\Work>rgb2a8 0 255 0
R=  0 G=255 B=  0 : $C6 Hue = 12 Lum = 6

D:\Work>rgb2a8 0 0 255
R=  0 G=  0 B=255 : $76 Hue = 7 Lum = 6

rgb2a8.zip

Link to comment
Share on other sites

The color converter maybe better re-written, again using the emulation code, but have it read a palette file and work from that. Better still, wrap it in an app that displays a colour picker.

 

The post #5 thread was for Access' "World Class Leaderboard" for the C64 (here) which had the elements of golf that the original Leaderboard didn't have, e.g. the trees, bunkers. The porting was fun because it followed up on something I found with the Barbarian port where you don't use obvious black as the background colour which actually works well.

 

The rendering was pretty much converted though the info bar at the top and the stats etc on the right-hand side also needed cleaning up. I think it had got to a stage where I wanted to introduce a file system to hold all the course/hole data but I tend to develop outside of a DOS/ATR image and prefer to try and roll things up in a cart image and so wanted to port some of the principles found in the Eidolon (which implements its own I/O but does also include a small read-file system). Next up would be consideration of the golf player animation. This I though would be best done ripping the animation code from the A8 Leaderboard and incorporating this into the game. So still a fair amount of work to do.

 

Also, no matter how I approach the loading screen within g2f I can't seem to find a way to best do this on the A8. :x

 

Regards,

Mark

 

P.S. I also thought their "10th Frame" would be cool to port too.

Link to comment
Share on other sites

  • 4 weeks later...
The color converter maybe better re-written, again using the emulation code, but have it read a palette file and work from that. Better still, wrap it in an app that displays a colour picker.

OK, so here's a first bash at this, playing around with Visual Studio Express 2008 C#.

 

Initial thoughts are that the 'shortest distance to' in the colourspace just ain't right. I started with having the RGB scanned but found that this seems to choose black->greys->white far more often than it should. I thought then to exclude the hue=0 band from the scan and then use some other method to determine if the colour was more 'grey' than 'color' but that seems hard.

 

So I've settled on using the L*a*b* colourspace which seems to be a little better?

 

Work to do:

 

Better handling of the Palette loading (e.g like in A800WinPLus)

Add a 'click' handler to the ColorView grid so that the color hit is selected.

Replace the text fields next to the sliders in the 'picker' area with NumericUpDown controls.

probably more... e.g. values to clipboard etc...

 

If anyone else comes has ideas or, even better, makes code enhancements - post here :)

 

Regards,

Mark

post-1822-1233610797_thumb.jpg

A8ColourMapper.zip

A8ColourMapperExe.zip

Edited by Wrathchild
Link to comment
Share on other sites

Some sort of "bias". I've noticed when using PhotoShop to convert stuff to palletted based on the A8 colours:

- some blues end up as Colour 10 (Green).

- like you said, many colours end up as greys.

 

I found that to a degree, incorrect greys can be prevented by first increasing colour saturation of the picture.

Blues being turned greenish can be averted by hue-shifting the entire pic slightly backwards.

 

Problem with having a set bias (ie hue shifting everything) is that you might have something like reds ending up orange, yellows ending up green etc.

 

A nice extension of this whole project might be a convertor that takes a 24-bit BMP as input, then generates a paletted 256 colour BMP as output.

Link to comment
Share on other sites

Depends how far you want to take it, I guess.

 

There's free stuff arnound (Gimp, etc) that can do all the resizing and nice Bicubic filtering and stuff, so why replicate what's already available?

 

The biggest frustration I have when doing cross-platform graphics stuff for the A8 is the colour conversion not turning out right.

 

One possible thing if you were wanting to take it further - being able to split into seperate files by scanline would be handy, for stuff like APAC, TIP/RIP, interlaced pics etc.

Link to comment
Share on other sites

  • 1 year later...

Gosh! A year on already... :(

 

I've finally gotten around to updating the colour distance algorithm to use the 'Delta E 1994' method (thanks PeteD for the recommendation!). This feels like a much better way of matching the RGB colours to the chosen Atari palette.

 

Regards,

Mark

 

This command line utility is pretty snazzy. If I'm feeling industrious, I'll whip up Mac OS X and Linux frontends for it, similar to your .NET one.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...