Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Kickassembler - Converting .PNG to Koala
2012-02-21 15:04
TWW

Registered: Jul 2009
Posts: 545
Kickassembler - Converting .PNG to Koala

Hey fellow hackers.

I wanted to write a converter in Kickassembler which can take any .PNG MC Bitmap screenshot from VICE (Then I don't need to worry about the RGB values since they are known) and convert into raw data you can use in your productions.

This is the way I imagine doing it:

#1 - Determin the background collor based on the most used collor in the picture
#2 - Verify there is no 4x8 block containing more than 3 collors+BG
#3 - Convert each 4x8 block afterwards and write the data into 3 lists (1 for BMP data, 1 for Charcollors and 1 for collmem).
#4 - Add BG collor at the end :-)

I'm looking for improvement comments on this or maybee I need to revise the way I think about this?
2012-02-21 16:07
Skate

Registered: Jul 2003
Posts: 494
#1 can be a little problematic since graphician might have filled a larger area with a color other than the original bg color. so, if you detect another color as the background color, you might have problems at 2nd step even if color usage is legal. so, i think bg color should be entered manually instead of an autodetection system. autodetection can be optional if parameter is null etc.

rest of the process seems pretty fine to me.
2012-02-21 18:26
chatGPZ

Registered: Dec 2001
Posts: 11386
"Determin the background collor based on the most used collor in the picture"
that does not work generically... you have to count how many colors are used in each 8x8 cell, and then from all 8x8 cells which use 4 colors pick a color that is used in all of these cells.
2012-02-21 19:49
MagerValp

Registered: Dec 2001
Posts: 1078
If you already have the image in VICE, save out the bitmap and color ram instead of taking a screenshot...
2012-02-21 21:17
STE'86

Registered: Jul 2009
Posts: 274
Please follow Skates advice on the autodetect.

most common colour in a bitmap most certainly does not always mean its BG colour. in my stuff anyway.

Steve
2012-02-21 23:16
Cruzer

Registered: Dec 2001
Posts: 1048
I vote for Groepaz's approach.
2012-02-22 01:00
TWW

Registered: Jul 2009
Posts: 545
ok.

Find the common collor in all 4x8 blocks with 4 collors instead of #1.

gotit. thanx
2012-02-22 08:17
The Human Code Machine

Registered: Sep 2005
Posts: 112
Groepaz's approach can also fail, if there are no blocks using 4 colors at the same time. For this I would make it optional to force the color by the user. Groepaz autodetection will always give the right picture, but not always the wanted background color.
2012-02-22 11:37
algorithm

Registered: May 2002
Posts: 705
What magervalp said. No need for any conversion if the image is displayed in vice. Use the d021 color from there and save the data.

bank io
bsave "d800loc" 0 $d800 dbe7
bsave "inkpaploc" 0 $0400 $07e7 ;varies of course
bsave "gfx" 0 $2000 $3f3f ; varies of course
bsave "d021loc" 0 $d021 d021
2012-02-22 11:44
kmeg
Account closed

Registered: Sep 2003
Posts: 5
If there is need for that I can update this tools The CCS64 Gfx Rippers to support Vice...
2012-02-22 12:23
Cruzer

Registered: Dec 2001
Posts: 1048
Quote: What magervalp said. No need for any conversion if the image is displayed in vice. Use the d021 color from there and save the data.

bank io
bsave "d800loc" 0 $d800 dbe7
bsave "inkpaploc" 0 $0400 $07e7 ;varies of course
bsave "gfx" 0 $2000 $3f3f ; varies of course
bsave "d021loc" 0 $d021 d021


This is supposed to be easier than taking a screenshot?
 
... 37 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 | 5 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Alakran_64
Guests online: 101
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.063 sec.