Page 1 of 1

Converting greyscale pictures

Posted: Sun 05 Mar, 2006 2:16 am
by Timendus
Does anyone know of a simple command line tool that converts greyscale images (BMP, or whatever) to two layers of data (preferably .db statements)? Nothing funky like that iStudio or graphics studio or whatever it's called, I just want to give it a filename as a command line parameter and have it spit out the bytes, either in a file or back to the console.

Posted: Sun 05 Mar, 2006 3:57 am
by threefingeredguy
My friend wrote a java program that does this with interlaced data, do you want me to ask him for it?

And Spencer's assembler has the abilty to just include a bitmap, but I think it is only black and white.

Posted: Sun 05 Mar, 2006 5:21 am
by tr1p1ea
There is that old program by Ian Graf i think? Gray83 or GCP or something?

Wouldnt be too hard to whip up a tool?

Posted: Sun 05 Mar, 2006 5:24 am
by kalan_vod
Isn't early morning going to surport this?

Posted: Sun 05 Mar, 2006 6:05 am
by Jim e
I used gcp, it worked very well.

Posted: Sun 05 Mar, 2006 1:48 pm
by Timendus
Hmm, I'm currently fighting with GCP, but it doesn't want to open my pictures... Ah, I can't use lower case characters in my filenames, just brilliant... and the "a" switch to disable the bugged adjust screen still flashes the adjust screen which makes my DOS box go fullscreen and black... :?

EarlyMorning is going to support this, but all my pictures are different sizes, so I'd have to make a new spritesheet for each picture, and I wasn't able to load/copy'n'paste my pictures into it, so I'd have to redraw them. EarlyMorning is very good for RPG development, but a bit over the top for my goals. I just want to include a directory full of images, without having to redraw them to two seperate layer images all the time.

Anyway, I could use either of these options, but none really satisfy me... Maybe I'll write my own tool.

Posted: Sun 05 Mar, 2006 3:47 pm
by Timendus
I wanted to write a proper tool to scan my program source for specific includes and add the two layer bitmap data there, but I was lazy :). I wrote a quick and dirty PHP script that goes through a directory with 256 color bitmaps and for each bitmap it goes through the data twice with str_replace to create two new bitmaps; one with lightgrey>black and darkgrey>white and one with lightgrey>white and darkgrey>black.

I added a call to this script to my Latenite build script for this project, so now when I press F5 in Latenite all my greyscale images get converted to two layer images which Brass then includes before PTI runs my program to show the pretty new imagery 8)

Now THAT's a proper debug cycle :P

If you want to do the same, unzip this to your Latenite/Templates/Projects folder:
http://timendus.student.utwente.nl/docs ... mplate.zip

!! Warning: Requires that you have a PHP interpreter properly installed on your computer, and hasn't been tested with bitmap images that weren't generated with MS Paint. In short: it sucks. But it works like a charm :)

Posted: Sun 05 Mar, 2006 4:08 pm
by tr1p1ea
Hahaha very nice stuff ... and you did it pretty quickly too! :).

Now you can stop getting on Ben's case about including such an option :).

Posted: Sun 05 Mar, 2006 4:28 pm
by Timendus
Posted: Sun 5-3-2006 14:48
Posted: Sun 5-3-2006 16:47

Less than two hours appearantly 8);)