Page 1 of 1

Script to convert RGB Images to Mega Drive "format"

Posted: Wed May 15, 2024 10:17 pm
by seanonearth
I made these scripts to make producing images (mostly backgrounds) quickly, without having to do something overly simple. It takes an RGB image, and converts it to something that can be reprisented as tiles.

You can set the palette size (16 default), tile size (8 default), and number of tiles (64 default, but you'll often want to change that).

There are two scripts:
  • quantize_image - doesn't reduce palette size. Use this if you want to post process.
  • quantize_3bp - this reduces palette, dithers, and selects colours from the Mega Drive hardware palette. The output is basically good to go


Git hub link - https://github.com/seanbouk/quantizeMD/tree/main - installation instructions on there


Example 1 - forest canopy from above. No tiling in input image
Input - Image

Output showing 64 tiles - Image

Example 2 - forest floor showing mud paths and huts from above:
Input - Image

Output preserves repeating tiles - Image

Example 3 - Render of 3D character
Input - Image

Output showing 1024 tiles - Image

NB - it doesn't make use of flipping tiles. It would probably work better if it did, but I couldn't get it working! Maybe a solution will come to me at some point.

Re: Script to convert RGB Images to Mega Drive "format"

Posted: Thu May 16, 2024 12:42 pm
by TmEE co.(TM)
This is impressive, even without flipping ! I imagine the forest example could benefit a lot from that.

Re: Script to convert RGB Images to Mega Drive "format"

Posted: Fri May 17, 2024 10:26 pm
by KanedaFr
Years ago, I made a HD image converter based on ToyStory trick : tiles on 2 plans, to offer 30 colors (2 pals with 0 index transparent)

Could you tool do the same ? I'll be interested by the result ;)

Re: Script to convert RGB Images to Mega Drive "format"

Posted: Sat May 18, 2024 2:57 pm
by seanonearth
Yeah, that's a good idea. I think that would be a small additional script to split a 31 colour image into two - 15 for the front and 16 for the back.

I've got some dithering edits I want to make next, but I'll keep it in mind. Ta.

Re: Script to convert RGB Images to Mega Drive "format"

Posted: Mon May 20, 2024 11:12 pm
by seanonearth
A couple of updates:

I made the dithering changes I wanted.
Image
Horizontal dithering makes horizontal scrolling when you're got a dithered layer over another dithered layer much less flickery (bayer dithering was producing a moiré effect). Maybe also looks like it's moving faster too. Still more testing in anger to do, but it's definitely the effect I was after so I'm happy with the code.

I added vertical style too, and no dithering. And also this...
Image
It's called cluster dot dithering. I'd not heard of it before this! But I took a minute to take a quick search for other dithering patterns I could drop in easily into my existing code, and I quite like it! Seems to work quite nicely for organic images, and it might be a decent start point if the goal is to manually edit the tiles after

I also added a new script called colour_split.py - which takes an image of up to 31 colours, and turns it into two separate images which can be placed on background and foreground

background -
Image

foreground -
Image

combined -
Image

That's 1024 tiles, so almost each tile is unique.

Re: Script to convert RGB Images to Mega Drive "format"

Posted: Wed May 29, 2024 2:33 pm
by Muzzy
Wow! Thats cool!!! :shock: Almost like Toy Story's trick, but less colors. Would be even cooler to get shadow/highlight mode involved to get up to 100+ colors :twisted:
viewtopic.php?f=7&t=3330&start=15#p37939

Re: Script to convert RGB Images to Mega Drive "format"

Posted: Sat Nov 23, 2024 5:34 pm
by bioloid
Color split option is awesome, thanks