English Amiga Board Converting a given palette to Extra Half-Brite
 Register Amiga FAQ Rules & Help Members List  /  Moderators List Today's Posts Mark Forums Read

 14 February 2020, 16:03 #1 roondar Registered User   Join Date: Jul 2015 Location: The Netherlands Posts: 2,068 Converting a given palette to Extra Half-Brite I've been wondering lately how you'd properly convert colours to an EHB specific palette. For non-EHB I can think of several approaches, but for EHB I'm kind of stumped on how to deal with the half-bright colours. Are there any good algorithms available for this (including source)? I did try to find some on EAB, but my search-fu was not particularly good so I found lots of threads on EHB in general.
 15 February 2020, 13:10 #2 Solo Kazuki Registered User   Join Date: Sep 2004 Location: Poland Posts: 884 To reduction colours in specific picture, i was using PPaint, which have good palette reduction parameters. But i suppose it's for overall work, not one picture?
 15 February 2020, 13:50 #3 chb Registered User   Join Date: Dec 2014 Location: germany Posts: 258 I used (for another color reduction problem, not EHB) a modified k-means algorithm, where I substituted the euclidean distance by a custom distance function. I guess in the case of EHB, the centers would be your 32 direct palette colors, but when computing the distance to a pixel color, you'd use the min of the distance to the direct color and the associated half brite color. It's a bit of a sloppy approach, because all the convergence theorems etc. for k-means assume euclidean distance, but for me it worked reasonably well. K-means is quite slow, however, so it's rather not well suited if you want to write something running on the Amiga.
15 February 2020, 14:06   #4
roondar
Registered User

Join Date: Jul 2015
Location: The Netherlands
Posts: 2,068
Quote:
 Originally Posted by Solo Kazuki To reduction colours in specific picture, i was using PPaint, which have good palette reduction parameters. But i suppose it's for overall work, not one picture?
Well, I want to convert a whole bunch of pictures (on the order of 200-300). I suppose I could use PPaint for it, but I thought it might be simple to just make a small program that does it manually.

I also had a look at http://tool.anides.de/ but that doesn't actually convert to EHB. It claims to do so, but the results are identical to the 32 colour version it generates
Quote:
 Originally Posted by chb I used (for another color reduction problem, not EHB) a modified k-means algorithm, where I substituted the euclidean distance by a custom distance function. I guess in the case of EHB, the centers would be your 32 direct palette colors, but when computing the distance to a pixel color, you'd use the min of the distance to the direct color and the associated half brite color. It's a bit of a sloppy approach, because all the convergence theorems etc. for k-means assume euclidean distance, but for me it worked reasonably well. K-means is quite slow, however, so it's rather not well suited if you want to write something running on the Amiga.
This makes me wonder how the old Amiga programs did this. I can't imagine them using something this slow.

Anyway, I must confess my own ideas where considerably simpler. I was looking at something more along the lines of modifying existing code like https://rosettacode.org/wiki/Color_quantization/C

Perhaps it's more efficient to select an existing program and scripting around it so it can do the slew of images I want to try. Which leads to the obvious question: which program is the best bet here. Probably an Amiga one, as I don't suppose modern programs support EHB output in any meaningful way.

 15 February 2020, 17:47 #5 chb Registered User   Join Date: Dec 2014 Location: germany Posts: 258 If you want to use an existing program, then there's also hamconvert which, despite the name, supports EHB and has a batch mode. PS: Rosetta code has an example of color quantization using k-means - unfortunately it is written in J, which at least for my eyes looks quite similar to banging your head on the keyboard. But it's very short! Last edited by chb; 15 February 2020 at 17:53.
 15 February 2020, 21:02 #6 Hewitson Registered User   Join Date: Feb 2007 Location: Melbourne, Australia Age: 37 Posts: 3,747 Wow. J looks almost as bad as Brainf**k. Completely unreadable and unusable language.
 15 February 2020, 22:51 #7 roondar Registered User   Join Date: Jul 2015 Location: The Netherlands Posts: 2,068 Yeah, J is something else. Give me 68000 assembly any day over that! I'll be checking out HAMconvert. See if that actually does create 64 colour images when converting to EHB
 15 February 2020, 23:21 #8 alpine9000 Registered User   Join Date: Mar 2016 Location: Australia Posts: 804 You can see here where I gave it a go to create an EHB converter: https://github.com/alpine9000/amiga_...r/011.ehb_mode I didn't really expend much effort at the time as EHB wasn't something I really saw myself using much.
 15 February 2020, 23:32 #9 roondar Registered User   Join Date: Jul 2015 Location: The Netherlands Posts: 2,068 Thanks, I'll check it out!
 17 February 2020, 03:46 #10 Hewitson Registered User   Join Date: Feb 2007 Location: Melbourne, Australia Age: 37 Posts: 3,747 alpine9000, do you have any ideas how the code could be improved to make better use of EHB? Not necessarily asking you to actually make the changes, I'm happy to have a play around with it.
 17 February 2020, 08:53 #11 Antiriad_UK OCS forever!   Join Date: Mar 2019 Location: Birmingham, UK Posts: 253 The pic to raw converter I use (KingCon by Hannibal/Lemon.) has a EHB conversion option. Not sure what it does but I can run a picture through it and spit out the raw + dc.w palette data if you have a test picture handy?
17 February 2020, 09:22   #12
alpine9000
Registered User

Join Date: Mar 2016
Location: Australia
Posts: 804
Quote:
 Originally Posted by Hewitson alpine9000, do you have any ideas how the code could be improved to make better use of EHB? Not necessarily asking you to actually make the changes, I'm happy to have a play around with it.
I am pretty sure my code just picks the “best” 32 colour palette, then does a quantisation of the original image with the 32 colour + 32 half bright colours.

Off the top of my head, I guess two ways to improve it would be picking the base palette with the intelligence that half bright colours exist and also taking advantage of the half bright colours in a more sophisticated way (like being used in a dithering algorithm for example).

 17 February 2020, 10:41 #13 roondar Registered User   Join Date: Jul 2015 Location: The Netherlands Posts: 2,068 I'm going to be using hamconvert for now (which is a very nice tool, by the way). Writing a proper colour quantisation algorithm for EHB is probably going to take more time than I want to spend on it at the moment. As for the why I'd want to.. Well, I've always been fascinated by EHB and don't always like the "HAM look". So I want to experiment a bit with images converted to EHB instead and see how that ends up. Last edited by roondar; 17 February 2020 at 11:08.
 17 February 2020, 13:05 #14 invent pixels   Join Date: May 2014 Location: Australia Age: 49 Posts: 349 Hi Roonar, I remember converting Rygar graphics to HalfBright mode. One of my approaches was to go to the export gif option in photoshop and here you can lock colours. Another setting first needs to happen, that is display most commonly used colours first, from this I’d then try to Eliminate colours that are very close in rbg value. The aim of course was to get 64 colour palette exported. Other option was to import the arcade graphics as a 256 colour image into Brilliance and let it convert. Happy to share what I came up with. By the way if you want any of us to experiment with converting graphics with a particular palette in mind please share the file Good luck and look forward to seeing what you come up with
 19 February 2020, 16:48 #15 roondar Registered User   Join Date: Jul 2015 Location: The Netherlands Posts: 2,068 Once I have something, I'll be sure to share it. But it may be a while yet
 20 February 2020, 16:23 #16 NorthWay Registered User   Join Date: May 2013 Location: Grimstad / Norway Posts: 661 I'd like to see a dynamic/sliced EHB converter/viewer for OCS...
 21 February 2020, 00:04 #17 invent pixels   Join Date: May 2014 Location: Australia Age: 49 Posts: 349 Thought I'd post the experimentation of HalfBright for Rygar, If nothing else was an interesting process of reducing arcade colours (256?) down to 64. The example at top left of the lava enemy shows 3 colours replaced using the darker versions., considering its only two red colours in the 32 colour palette it works pretty well. Attached Thumbnails
 24 February 2020, 19:40 #18 TCH Newbie Amiga programmer   Join Date: Jun 2012 Location: Front of my A500+ Age: 34 Posts: 184 Perhaps you can use my image converter? (http://bgafc.t-hosting.hu/prgv.php?p=2) If you have a palette which you want to convert into EHB, then you can just save an image with it and convert it with the converter.
 05 July 2020, 15:18 #19 ImmortalA1000 Registered User   Join Date: Feb 2009 Location: london/england Posts: 402 I used HAMconvert to do some SF2 arcade full widescreen mockups in EHB and they look fantastic. And if you was actually going to try and code it you would actually use the copper at least once and edit the arcade palette a bit (like Dhalsim's graduated floor of stone and carpet) for better colour reduction and even on SCART RGB you would be hard pressed to tell arcade images and EHB images displayed in Dpaint 4 by your A1200 I would upload them but if you saw them you would probably go to the founder of US Gold's mansion and do illegal things to him, which I don't condone!
 11 July 2020, 06:33 #20 AmigaHope Registered User   Join Date: Sep 2006 Location: New Sandusky Posts: 725 Stupid and definitely-not-optimal algorithm I came up with a long time ago that seemed to work pretty well: Work in HSV space. Find median brightness value, quantize brightest half to 32 colors with your favorite palette-reduction algorithm, quantize darkest half to 32 colors too. Arrange results in 3D HSV space. Find nearest neighbors in HSV space between both sets with V*2 for second set, average all values between nearest neighbors (then dividing V by 2 again for the halfbrite set). Take this as your final palette and requantize original image to it. This produces pretty good pictures as long as the brighter colors do not have wildly different hues from the darker colors. Last edited by AmigaHope; 12 July 2020 at 09:52.

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Similar Threads Thread Thread Starter Forum Replies Last Post gimbal OT - Gaming 5 22 December 2019 15:34 Foebane Amiga scene 15 13 September 2015 12:18 Firestone support.Hardware 12 28 August 2013 08:05 TheFoxSoft Retrogaming General Discussion 4 24 April 2012 10:37 tim_calladine AMR data problems 9 01 October 2008 17:22

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News Main     Amiga scene     Retrogaming General Discussion     Nostalgia & memories Support     New to Emulation or Amiga scene         Member Introductions     support.WinUAE     support.WinFellow     support.OtherUAE     support.FS-UAE         project.AmigaLive     support.Hardware         Hardware mods         Hardware pics     support.Games     support.Demos     support.Apps     support.Amiga Forever     support.Amix     support.Other Requests     request.UAE Wishlist     request.Old Rare Games     request.Demos     request.Apps     request.Modules     request.Music     request.Other     Looking for a game name ?     Games images which need to be WHDified abime.net - Hall Of Light     HOL news     HOL suggestions and feedback     HOL data problems     HOL contributions abime.net - Amiga Magazine Rack     AMR news     AMR suggestions and feedback     AMR data problems     AMR contributions abime.net - Home Projects     project.Amiga Lore     project.EAB     project.IRC     project.Mods Jukebox     project.Wiki abime.net - Hosted Projects     project.aGTW     project.APoV     project.ClassicWB     project.Jambo!     project.Green Amiga Alien GUIDES     project.Maptapper     project.Sprites     project.WinUAE - Kaillera Other Projects     project.Amiga Demo DVD     project.Amiga Game Factory     project.CARE     project.EAB File Server     project.CD32 Conversion     project.Game Cover Art         GCA.Feedback and Suggestions         GCA.Work in Progress         GCA.Cover Requests         GCA.Usefull Programs         GCA.Helpdesk     project.KGLoad     project.MAGE     project.Missing Full Shareware Games     project.SPS (was CAPS)     project.TOSEC (amiga only)     project.WHDLoad         project.Killergorilla's WHD packs Misc     Amiga websites reviews     MarketPlace         Swapshop     Kinky Amiga Stuff     Collections     EAB's competition Coders     Coders. General         Coders. Releases         Coders. Tutorials     Coders. Asm / Hardware     Coders. System         Coders. Scripting         Coders. Nextgen     Coders. Language         Coders. C/C++         Coders. AMOS         Coders. Blitz Basic     Coders. Contest         Coders. Entries Creation     Graphics         Graphics. Work In Progress         Graphics. Finished Work         Graphics. Tutorials     Music         Music. Work In Progress         Music. Finished Work         Music. Tutorials Off Topic     OT - General     OT - Entertainment     OT - Sports     OT - Technical     OT - Gaming

All times are GMT +2. The time now is 06:30.

 -- EAB3 skin ---- EAB2 skin ---- Mobile skin Archive - Top