+selgus Posted January 6, 2009 Share Posted January 6, 2009 Does anyone know of a good program for converting RGB values to the closest Atari palette COL/LUM values? Thanks. --Selgus Quote Link to comment Share on other sites More sharing options...
+Stephen Posted January 7, 2009 Share Posted January 7, 2009 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 Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted January 7, 2009 Share Posted January 7, 2009 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 Quote Link to comment Share on other sites More sharing options...
+selgus Posted January 8, 2009 Author Share Posted January 8, 2009 I used something way back when on this thread: Post #5 Thanks, this seems to be what I was looking for! --Selgus Quote Link to comment Share on other sites More sharing options...
tjb Posted January 11, 2009 Share Posted January 11, 2009 I've been wondering about the conversion myself. This is quite useful. BTW, what was the project in post #5? Did you ever finish it? It looked great! tjb Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted January 11, 2009 Share Posted January 11, 2009 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. Regards, Mark P.S. I also thought their "10th Frame" would be cool to port too. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted February 2, 2009 Share Posted February 2, 2009 (edited) 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 A8ColourMapper.zip A8ColourMapperExe.zip Edited February 2, 2009 by Wrathchild Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 2, 2009 Share Posted February 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted February 2, 2009 Share Posted February 2, 2009 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. Hi Rybags, Do you mean a straight pixel-for-pixel conversion with no attempt to take neighbours into consideration? Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 3, 2009 Share Posted February 3, 2009 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. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted February 3, 2009 Share Posted February 3, 2009 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. Indeed, I was once looking for an easier way to get the R,G,B files for ColorView for images. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted February 8, 2010 Share Posted February 8, 2010 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 A8ColourMapperExe.zip 1 Quote Link to comment Share on other sites More sharing options...
+Ryan Witmer Posted February 9, 2010 Share Posted February 9, 2010 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. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted February 9, 2010 Share Posted February 9, 2010 Good point, I should update the calculation logic within the command line app too and perhaps add an option for specifying a palette file to map against. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted February 9, 2010 Share Posted February 9, 2010 Here's a version which just uses a fixed palette but this still comes out with a reasonble match. This time built with VC++ Express 2008 - sources included. rgb2a8_exe.zip rgb2a8_src.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.