dMZX Forums: png2smzx - dMZX Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

png2smzx Smzx Mode 3

#1 User is offline   apage43 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,199
  • Joined: 13-November 00
  • Gender:Male

Post icon  Posted 16 August 2004 - 05:09 PM

Okay, this thing, will take a PNG file, and make a mzm, chr, and pal from it, for use in SMZX MODE 3.
I tested it mostly on images from Logicow's Vapourware Platformer post, since they were for the most part already smzx-ready.
To use it, you'll probably want to open a command window and go to where you unzipped the converter.
Usage: png2smzx <pngfile> <filenamebase> [offset]
pngfile: Filename to convert
filenamebase: the base of the filename. if this were foo, foo.chr, foo.pal, and foo.mzm would be generated.
offset: Offset into the charset, If you load the outputted charset as a partial charset, put the offset here and the output mzm file will be adjusted accordingly

If you are converting a non smzx-perfect image, you'll want to make sure it's a true color image, (not indexed) before you run it through the converter so that it will make sure each char has only 4 colors.
(Also when you run the converter on a truecolor image it generates imageresampled.png which is the image with each char containing 4 colors. This will exist even if the conversion to smzx failed)

Also, it shows a LOT of debug info, and perhaps some warnings from my awful code ;)

Screenshots of MZX:
Whee! The PHP Logo
Logicow's guy with a sword

EDIT: SOURCE CODE!!!11OMG
EDIT: Also, use images that are small, it doesn't downsize them.

Attached File(s)


This post has been edited by Kurushimi: 21 January 2005 - 02:33 AM

0

#2 User is offline   asgromo 

  • steiner, porsches
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,841
  • Joined: 04-May 02
  • Gender:Female
  • Location:New York State

Posted 16 August 2004 - 06:06 PM

YOU BASTARD

You're making MegaZeux too easy. -_-
0

#3 User is offline   LogiCow 

  • Holiday cow
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,671
  • Joined: 18-July 02
  • Gender:Male
  • Location:Quebec

Posted 16 August 2004 - 06:13 PM

SMZX mode can NEVER be too easy
0

#4 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 16 August 2004 - 06:15 PM

LogiCow, on Aug 16 2004, 12:13 PM, said:

SMZX mode can NEVER be too easy

SMZX 1 & 2 are, too me. It is the SMZX 2 palettes that get me. =(
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#5 User is offline   apage43 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,199
  • Joined: 13-November 00
  • Gender:Male

Posted 16 August 2004 - 06:42 PM

Also, if you get too many colors when converting a true color image, load imageresampled.png, downsample it to a smaller amount of colors (DO NOT DITHER) with a image editor, save, and convert THAT.
0

#6 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 16 August 2004 - 07:05 PM

Is this still only 16 colors?

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#7 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 16 August 2004 - 07:17 PM

I think the 16 color thing was only for that specific picture that was converted.

I could be wrong.

It wouldn't make sense to make a graphic converter for a smzx mode that only handled 16 colors.
0

#8 User is offline   apage43 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,199
  • Joined: 13-November 00
  • Gender:Male

Posted 16 August 2004 - 08:29 PM

Koji is CORRECT! ;)
Yes my post about a 16 color palette was specific to that image... On the sword image it makes a 111 color palette ;) I need better palette optimization.
0

#9 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 16 August 2004 - 09:07 PM

perhaps the the order at which the colors are detected is messing up the actual order of the colors that are to be in the palette in the optimization...

IOW, perhaps you have black, blue, red, and green are to be used in 4 characters but how the characters are set up, they are not always detected in that order, SO the optimiser doesn't catch that these mini palettes are infact the same thing. infact where there should be a 00 pixel, the optimizer might put a 01, 10, or 11 pixel, depending on the order at which the colors were detected.

Detect which characters will need what colors, then make sure when looking for matches, that you are not constrainting to the order at which the colors appear in the character area.

I really cannot think of another way to describe that. But tell me if you didn't understand me there..
0

#10 User is offline   Spectere 

  • Resident Spectere Fanboy
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,111
  • Joined: 18-June 04
  • Gender:Male
  • Location:Struthers, OH, USA

Posted 16 August 2004 - 09:22 PM

Posted Image

Fun little tool...
:)
0

#11 User is offline   apage43 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,199
  • Joined: 13-November 00
  • Gender:Male

Posted 16 August 2004 - 09:31 PM

Spectere: <3
Koji: Uhh. Well, the optimizer works by loading up the palette,
running through each pixel and loading the colors each character needs into arrays, looping through the arrays, checking if the colors a character needs are in any 'color set', if not, it makes a new color set with that characters needs, then it does color set loop again so if a colorset with a characters needs was made after that character was checked it will be used instead, then it deletes the colorsets that were obsoleted in the second pass. It doesn't do very well with images that werent meant for mzx, like true color images. It depends on the image really, due to the way the colorsets work, order doesnt matter, say char 1 needs colors 3 5 and 6
Colorset 1: 2, 8, 9, 4
Colorset 2: 3, 5, 4, 6
It would pick colorset 2 and arrange the char in the charset accordingly.
(So yeah, it pretty much already works the way you are describing)
It's just that truecolor images create lots of colors. You can see on the php logo image where the 4 color per 8x14 rectangle conversion happens. Some images work rather nicely in it and you cant see the boundary at all, (like Spectere's) because they didn't have many colors to begin with, the php logo had all sorts of cool effects on the edges, n' stuff.
(Also if your image isn't good charset size it rounds down instead of up, so if you want to be sure to get all of it, either make sure the height is divisible by 14 and the width by 8 or put some blank space on the right and on the bottom that might get cut off)

This post has been edited by apage43: 16 August 2004 - 09:48 PM

0

#12 User is offline   Smallhacker 

  • Hey! My monitor turned black!
  • PipPipPip
  • Group: Members
  • Posts: 405
  • Joined: 16-September 02
  • Location:Sweden

Posted 16 August 2004 - 09:47 PM

Looks nice, but how the heck do you use it? I tried downloading the ZIP. It is empty. I downloaded it five more times. Still empty. I made a page on my site that was a copy of the PHP source code. Didn't work. ;)
Smallhacker Lexicon:

Smallhacker: (noun) -s ; Read the post above.
Small Hacker: (noun) -s ; Typo.
Smallhacker Counter: (noun) -s ; If set to 1, it allows 8 colors/char without resoloution loss.

Sign version 2.5
0

#13 User is offline   zombieguy 

  • Veteran Member
  • Group: Banned
  • Posts: 1,939
  • Joined: 29-June 02
  • Gender:Male
  • Location:Australia, Queensland.

Posted 16 August 2004 - 09:55 PM

Smallhacker, on Aug 17 2004, 07:47 AM, said:

Looks nice, but how the heck do you use it? I tried downloading the ZIP. It is empty. I downloaded it five more times. Still empty. I made a page on my site that was a copy of the PHP source code. Didn't work. ;)

Try downloading it with a different computer, if you have access to one. The zip is fine.
0

#14 User is offline   Micah 

  • Ancient Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 5,330
  • Joined: 25-January 03
  • Gender:Male

Posted 17 August 2004 - 02:36 AM

Uh...how do I use this? There needs to be a readme or help file included.

Edit: To clarify, opening the .exe does nothing. Can't open it in DOS,
copying the .png and pasting it into the .exe does nothing.

This post has been edited by Micah: 17 August 2004 - 02:43 AM

♫ ▄ █ ▄ █ ▄ █ ▄
0

#15 User is offline   apage43 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,199
  • Joined: 13-November 00
  • Gender:Male

Posted 17 August 2004 - 02:56 AM

Open a command window.
Say you extracted the zip to C:\png2smzx
type:

cd\png2smzx
png2smzx file.png foo

(It would then try to make foo,chr, foo.pal, and foo.mzm . Spectere and ZombieGuy figured it out, you can too ;) )
0

#16 User is offline   Micah 

  • Ancient Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 5,330
  • Joined: 25-January 03
  • Gender:Male

Posted 17 August 2004 - 03:07 AM

Yeah I did that. I tried doing that in DOSBox, but it just said that the
program can't be used in DOS mode.
♫ ▄ █ ▄ █ ▄ █ ▄
0

#17 User is offline   Xombie 

  • I am the :cyclops:, I am the cesium.
  • PipPipPipPip
  • Group: Members
  • Posts: 569
  • Joined: 01-April 02

Posted 17 August 2004 - 03:17 AM

just create a batch file with the parameters you need in it. thats what I did when I was playing around with it
0

#18 User is offline   Spectere 

  • Resident Spectere Fanboy
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,111
  • Joined: 18-June 04
  • Gender:Male
  • Location:Struthers, OH, USA

Posted 17 August 2004 - 06:22 AM

apage43, on Aug 16 2004, 04:31 PM, said:

Some images work rather nicely in it and you cant see the boundary at all, (like Spectere's) because they didn't have many colors to begin with

Heh, I found out that you definitely have to have a very image to begin with. There were a few pictures that I tried before I fooled with my avatar image (including the picture that was the inspiration for my avatar...long story...). After much tinkering I found that photos don't really work out very well at all. Well, not like I really expected them to. We are talking about a text-based GCS, after all.

Edit: Hey...you can almost tell what's going on in this pic:

Posted Image

This post has been edited by Spectere: 17 August 2004 - 06:34 AM

:)
0

#19 User is offline   Revvy 

  • Jeez guys, there's no need to be narky.
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,520
  • Joined: 05-March 01
  • Gender:Male
  • Location:Ontario, Canada

Posted 17 August 2004 - 08:14 AM

I thought that was one of those stereotypical computer hardware chip shots until I noticed that it was a Stepmania screen =(
<+AFK> Bringing whisky to my mother is like irrigating a lake.

<+AFK> dormando's apathy is palpable.
* AFK palpates
<dormando> stop that

<Malwyn> undressing with revvy a little over a metre away. new definition of awkward.
0

#20 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,936
  • Joined: 20-March 02
  • Location:ur mom nmiaow

Posted 17 August 2004 - 08:36 AM

Micah, on Aug 17 2004, 03:07 AM, said:

Yeah I did that. I tried doing that in DOSBox, but it just said that the
program can't be used in DOS mode.

Well obviously it won't work in DOSbox, since it's not DOS. Clarify what the exact error you got was when you ran, from a Windows command line

png2smzx picture.bmp output

Does it give you an error? Does it crash with a 'segmentation fault'? Does it reset your machine?
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#21 User is offline   Xombie 

  • I am the :cyclops:, I am the cesium.
  • PipPipPipPip
  • Group: Members
  • Posts: 569
  • Joined: 01-April 02

Posted 17 August 2004 - 08:46 AM

picture.bmp? I thought it only worked on png files
0

#22 User is offline   Spectere 

  • Resident Spectere Fanboy
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,111
  • Joined: 18-June 04
  • Gender:Male
  • Location:Struthers, OH, USA

Posted 17 August 2004 - 09:02 AM

Revvy, on Aug 17 2004, 03:14 AM, said:

I thought that was one of those stereotypical computer hardware chip shots until I noticed that it was a Stepmania screen =(

Nope, not StepMania, that was a photo of DDR Extreme (hence the not-so-perfect angle). I uploaded the original photo here: http://homepage.mac....aa_original.png

I'm going to keep working with this program -- I want to find a way to get a photo down to MegaZeux quality. I was sort of hoping that the above photo would work out a little bit better since it's almost a direct shot of the screen, but it's clearly too complex for the converter. I'll probably fool around with it a little bit tomorrow, like when it's not 5 AM. ;)

This post has been edited by Spectere: 17 August 2004 - 09:03 AM

:)
0

#23 User is offline   Micah 

  • Ancient Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 5,330
  • Joined: 25-January 03
  • Gender:Male

Posted 17 August 2004 - 12:10 PM

I got it working for the most part, after talking to apage in IRC.
♫ ▄ █ ▄ █ ▄ █ ▄
0

#24 User is offline   Smallhacker 

  • Hey! My monitor turned black!
  • PipPipPip
  • Group: Members
  • Posts: 405
  • Joined: 16-September 02
  • Location:Sweden

Posted 17 August 2004 - 12:35 PM

Ok. I managed to download it on my laptop. A very nice program. I made a small animation in MZX of the dancing banana emoticon. ;) However, MZX is too slow to load char sets, palettes and mzms at the same time, resulting in some flickering.

Anyway, I have a suggestion:
Character optimizing.
The program detects if there's two characters that looks the same. If there are any, only one of them is written to the .chr to save space.
Smallhacker Lexicon:

Smallhacker: (noun) -s ; Read the post above.
Small Hacker: (noun) -s ; Typo.
Smallhacker Counter: (noun) -s ; If set to 1, it allows 8 colors/char without resoloution loss.

Sign version 2.5
0

#25 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 17 August 2004 - 01:37 PM

If you had a photo, you *COULD* move it into photoshop and sample down the colors to something more sane like 32, 64, or 128 (MAYBE) and THEN the png2smzx3 should be able to transfer it just fine, in theory.
0

#26 User is offline   Smallhacker 

  • Hey! My monitor turned black!
  • PipPipPip
  • Group: Members
  • Posts: 405
  • Joined: 16-September 02
  • Location:Sweden

Posted 17 August 2004 - 03:57 PM

Here's something I threw together. However, the original pictures had too many tiles in it, so I had to remove the tile duplicates, run it through the program and then assamble them in MZX.
Also, there's 2 other problems. 1: NES's screen have got a higher height than MZX. 2: NES have got 8x8 tiles. MZX have got 8x14. That means that at certain points, up to 8 colors / tile might be required.

Attached image(s)

  • Attached Image: post-15-1092758251.png

Smallhacker Lexicon:

Smallhacker: (noun) -s ; Read the post above.
Small Hacker: (noun) -s ; Typo.
Smallhacker Counter: (noun) -s ; If set to 1, it allows 8 colors/char without resoloution loss.

Sign version 2.5
0

#27 User is offline   barbarian 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,561
  • Joined: 11-June 01
  • Gender:Male
  • Location:Dublin, Ireland

Posted 17 August 2004 - 03:58 PM

Very nice tool. I found that it was entirely non-functional when using a command prompt in Windows 98, but it worked fine in a window.

I used a modified shortcut for the file ("c:\mzx\utils\png2smzx.exe pic.png foo output") as was mentioned as opposed to typing into a prompt. Great job!
Final Year Project Blog: http://mtsynth.blogspot.com/
0

#28 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 17 August 2004 - 08:28 PM

Smallhacker, on Aug 17 2004, 10:57 AM, said:

Here's something I threw together. However, the original pictures had too many tiles in it, so I had to remove the tile duplicates, run it through the program and then assamble them in MZX.
Also, there's 2 other problems. 1: NES's screen have got a higher height than MZX. 2: NES have got 8x8 tiles. MZX have got 8x14. That means that at certain points, up to 8 colors / tile might be required.

You can't have both of these problems at the same time. If tiles are 8x8 then the resolution would only be 256x224 (or 256x240 PAL) which is well without MZX's resolution. Or, if you use quadrupled resolution, the tiles are 16x16. Which can still give problems with MZX's chars, but not as many.

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#29 User is offline   Smallhacker 

  • Hey! My monitor turned black!
  • PipPipPip
  • Group: Members
  • Posts: 405
  • Joined: 16-September 02
  • Location:Sweden

Posted 17 August 2004 - 09:03 PM

Oops. Yes, I forgot to mention that the picture is four times as large to avoid the "two pixles becomes one big" problem.
Smallhacker Lexicon:

Smallhacker: (noun) -s ; Read the post above.
Small Hacker: (noun) -s ; Typo.
Smallhacker Counter: (noun) -s ; If set to 1, it allows 8 colors/char without resoloution loss.

Sign version 2.5
0

#30 User is offline   Pyro1588 

  • wojtek
  • PipPip
  • Group: Members
  • Posts: 145
  • Joined: 20-October 02
  • Gender:Male
  • Location:Minnesota

Posted 17 August 2004 - 10:08 PM

interesting. i'm downloading it and can't wait to try it out. this will make ripping graphics for mzx a lot easier. i might even be able to do that zelda game that i once thought up in mzx.
<Tox> bah. I may as well give in and shop australia. D:
<pyro1588> "welcome to australia, can i help you find what you're looking for?"
<Tox> pyro1588, I'm giving you the most reproachful of glares right now.
--------
Go show those nutty Koreans what us crazy Europeans are made of pirate.gif pirate.gif pirate.gif - Saike
<exophase> The old Commodore strategy of, "Go friggin' bankrupt!"
<wervyn> Go away! I'm writing the same engine I always do!
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users