| |
Case
Registered: Aug 2002 Posts: 142 |
Converting PNG to chars
Hi,
I have a 1 x 2 font that I want to convert into a c64 format that I can use. Currently its a png format and when I loaded it into Charpad, it does convert it but it also removes duplicate characters and then makes a map of the character set layout where i just want it as a normal c64 charset. |
|
| |
Raistlin
Registered: Mar 2007 Posts: 680 |
You could load into Pixcen I think, something like Unrestricted Hires, and then save the MAP file. That should be what you need?
Otherwise, send to me and I’ll send you a charset BIN back? I have tools I’ve made for C64GFX scraping that I made for this sort of thing :-) |
| |
Jetboy
Registered: Jul 2006 Posts: 337 |
you can load it straight into kickass and process it there. can't recall propper syntax from the top of my head, sorry |
| |
Burglar
Registered: Dec 2004 Posts: 1101 |
png2prg 1.8 supports all char-modes, but it doesn't do anything special for 1x2 or 2x2 character sets, so you'll have to do the reordering yourself.
I guess you want a charset ordered like this (for letters abc):
$01,$02,$03
$81,$82,$83 |
| |
The Syndrom
Registered: Aug 2005 Posts: 59 |
did you uncheck the "remove duplicate chars" option when importing the png into charpad ? |
| |
Burglar
Registered: Dec 2004 Posts: 1101 |
oh, I didnt read, png2prg does allow "-no-pack", but this will only convert the first 256 chars in a png...
If you do not want charpacking, eg for a 1x1 charset, please use -no-pack. |
| |
Raistlin
Registered: Mar 2007 Posts: 680 |
What Burglar says is right. For a typical 1x2 font, you probably want a PNG that is 512x16px .. so 64 chars across, 2 chars down.
That should convert in PNG2PRG (with the "no pack" option) to the form that you want .. so you have for example:-
A = $01 (top half), $41 (bottom half)
Z = $1a (top half), $5a (bottom half)
! = $21 (top half), $61 (bottom half)
0 = $30 (top half), $70 (bottom half)
etc.
That should give you a 1024 byte BIN file. |
| |
Burglar
Registered: Dec 2004 Posts: 1101 |
Quoting RaistlinWhat Burglar says is right. For a typical 1x2 font, you probably want a PNG that is 512x16px .. so 64 chars across, 2 chars down.
That should convert in PNG2PRG (with the "no pack" option) to the form that you want
actually, custom png sizes for chars is not (yet) supported by png2prg... |
| |
Case
Registered: Aug 2002 Posts: 142 |
Quote: did you uncheck the "remove duplicate chars" option when importing the png into charpad ?
I wish, i cannot find any such option. Would have made this so much easier. |
| |
Case
Registered: Aug 2002 Posts: 142 |
Quote: you can load it straight into kickass and process it there. can't recall propper syntax from the top of my head, sorry
That would be great, but unfortunately for this project I am using TASS64 because that was what it was started in. |
| |
Mixer
Registered: Apr 2008 Posts: 452 |
Unless one of the proposed tools can do it, it takes just a few lines of Python code to do the conversion using PIL. |
| |
Raistlin
Registered: Mar 2007 Posts: 680 |
I believe Pixcen can do it… but otherwise, feel free to send me the PNG? |
| |
Jetboy
Registered: Jul 2006 Posts: 337 |
Quoting CaseThat would be great, but unfortunately for this project I am using TASS64 because that was what it was started in.
Then, convert it in kickass, and import into TASS64 as a binary.
Quoting RaistlinI believe Pixcen can do it… but otherwise, feel free to send me the PNG?
Give him the fishing pole, not the fish ;) |
| |
soci
Registered: Sep 2003 Posts: 480 |
Can you convert that font to 8000 byte hires bitmap? Or at least to some format which has such part embedded? If so it should be relatively simple to cut/rearrange that.
Put the 8x16 pixel characters left-right top-bottom in a 256x64 pixel area in the top left corner before doing the bitmap conversion.
Then get 4 times 256 bytes every 640 bytes (top half of chars to 0-127) and another 4 times 256 with a 320 byte offset (bottom half of chars to 128-255).
Don't over complicate it, can be even written as 8 lines of ".binary" with hardcoded offsets. |
| |
Dano
Registered: Jul 2004 Posts: 234 |
Opened up ChatGPT with o1-preview, gave it a prompt. Took the code and arranged it a little to fit the need.
In C# though, that's my home turf.
Was too lazy to massage the image into someting more c64-like.
Would have done it in KickAssembler scripting in the evening, but that task sounded more interesting than the stuff at work.. :D
That "do not remove duplicate chars" option is really missing in CharPadFree it seems. |