dMZX Forums: BMP to MZM - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

BMP to MZM I'm sure it's been done before

#1 User is online   Lachesis 

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

Post icon  Posted 06 July 2007 - 10:32 PM

Gentlemen, I bring you...

Posted Image
Click image to download: BMP to MZM

...yeah. It takes a 16 color BMP saved in MSPaint (doesn't support any different palettes) and makes an MZM out of it. For some reason anything above 80x50 doesn't get read and cut off correctly, and... stuff's explained in the file. Comes with the BMP shown in the above screenshot and a large BMP that I was using to test large files with.

I made this to save myself from the effort of hand-copying stuff like Czar Dragon.
"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

#2 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 06 July 2007 - 10:43 PM

Nice but testbig doesn't come out right.
user posted image
koji: SCRUMTRELLESCENT!
0

#3 User is online   Lachesis 

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

Posted 06 July 2007 - 10:50 PM

CHEZZY, on Jul 6 2007, 03:43 PM, said:

Nice but testbig doesn't come out right.

yeah, i programmed it specifically so that it would just ignore extra data on big files but apparently i did something wrong somewhere... oh well
"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

#4 User is offline   CHEZZY 

  • sometimes... I dream about cheese
  • PipPipPipPip
  • Group: Members
  • Posts: 996
  • Joined: 08-April 06
  • Location:New Zealand

Posted 06 July 2007 - 11:38 PM

yay

Attached image(s)

  • Attached Image: post-15-1183765134.png

user posted image
koji: SCRUMTRELLESCENT!
0

#5 User is offline   Dr Lancer-X 

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

Posted 07 July 2007 - 01:57 AM

Would it be that difficult to make it take variable palettes, really?
set "$INPUT" "test.bmp"
set "$OUTPUTMZM" "test.mzm"
set "$OUTPUTPAL" "test.pal"

set "commands" "(-1>>1)"

set "&$INPUT&" "fread_open"
set "$header" "fread10"
set "bmpoffset" "('fread_counter'+('fread_counter'<<16))"
set "paloffset" "('fread_counter'+('fread_counter'<<16)+14)"
set "fread_pos" "paloffset"
set "&$OUTPUTPAL&" "fwrite_open"
loop start
set "$quad" "fread4"
set "fwrite" "('$quad.2'/4)"
set "fwrite" "('$quad.1'/4)"
set "fwrite" "('$quad.0'/4)"
loop 15
set "&$OUTPUTMZM&" "fwrite_open"
set "$mzmheader" "MZM2"
set "$mzmheader" "fwrite4"
set "fwrite_counter" 80
set "fwrite_counter" 25
set "fwrite_pos" 16
set "fread_pos" "bmpoffset"
set "$scr" "fread2000"
set "" "fread_open"
loop start
set "x" "('loopcount'%40)"
set "y" "(24-('loopcount'/40))"
set "fwrite" 5
set "fwrite" 223
set "fwrite" "('$scr.('y'*80+'x')'/16*16+('$scr.('y'*80+'x'+40)'/16))"
inc "fwrite_pos" 3
set "fwrite" 5
set "fwrite" 223
set "fwrite" "('$scr.('y'*80+'x')'%16*16+('$scr.('y'*80+'x'+40)'%16))"
inc "fwrite_pos" 3
loop 999
set "" "fwrite_open"

Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#6 User is offline   LogiCow 

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

Posted 07 July 2007 - 01:58 AM

In Fritz Blitz, when you change the background BMPs the changes apply in the game.

Horray for file handling in mzx!
0

#7 User is offline   asiekierka 

  • ??
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,268
  • Joined: 06-April 06
  • Gender:Male
  • Location:Poland

Posted 07 July 2007 - 08:56 AM

Nedemai's the same and even better! And yes, i have all his bmp->MZX work. That is:
- 1bit 160x50 BMP to MZX
- 4bit 80x50 BMP to MZX
- 4colour RAW to MZX charset
- 8bit BMP to HTML
- 8bit 80x25 BMP to SMZX

And of course, 24bit one about which you know already.
Huh.
0

#8 User is online   Lachesis 

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

Posted 07 July 2007 - 04:22 PM

So I wasted half of my day's actual work-time on nothing? :(

i guess i'm still absolutely worthless here
"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

#9 User is offline   asgromo 

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

Posted 07 July 2007 - 05:07 PM

Kuroneko, on Jul 7 2007, 12:22 PM, said:

So I wasted half of my day's actual work-time on nothing? :(

i guess i'm still absolutely worthless here

heck man I probably would have given up before I even tried looking for one, let alone making my own
0

#10 User is offline   asiekierka 

  • ??
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,268
  • Joined: 06-April 06
  • Gender:Male
  • Location:Poland

Posted 07 July 2007 - 05:27 PM

But Nedemai didn't publish these... or did he?
BTW: make AVI to 8-bit SMZX 80x50 MZMs and you will rock!

This post has been edited by asiekierka: 07 July 2007 - 05:34 PM

Huh.
0

#11 User is online   Lachesis 

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

Posted 07 July 2007 - 06:22 PM

Quote

And yes, i have all his bmp->MZX work.

Quote

But Nedemai didn't publish these... or did he?


asie, last time i checked nedemai was a girl :(

and no i am not fucking around with avis because lancer or some shit will post more efficient code and then nedemai or someone will have already made a better one before it all

actually i'm pretty sure she DID make an avi interpreter in mzx
"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

#12 User is offline   asiekierka 

  • ??
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,268
  • Joined: 06-April 06
  • Gender:Male
  • Location:Poland

Posted 07 July 2007 - 07:42 PM

nope. Lancer did RAW->MZX. and right, i am just dumb.
She didn't. :(
Well, welcome in club! Nobody cares about me too.
Huh.
0

#13 User is online   Lachesis 

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

Posted 07 July 2007 - 08:41 PM

asiekierka, on Jul 7 2007, 12:42 PM, said:

She didn't. :(

I specifically remember her talking about watching south park in mzx one day with a video to mzx engine she made
"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

#14 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,262
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

Posted 07 July 2007 - 11:20 PM

congratulations, kuroneko, for navigating the horrible BMP format!

I mean I made that RAW thing and that was pretty hard a while ago... but I couldn't take making something like this!

Also, "80x50 MZM saved to..."? Is it not saved in halfchars?

This post has been edited by CJA: 07 July 2007 - 11:21 PM

Need a dispenser here.
0

#15 User is offline   Dr Lancer-X 

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

Posted 08 July 2007 - 12:20 AM

oh come on 'horrible BMP format'. it's a few bytes of header data!
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#16 User is online   Lachesis 

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

Posted 08 July 2007 - 12:25 AM

BMP isn't too hard. 16 color has a header that's 118 bytes (4 for X size, 4 for Y size, 6 for each color and 16 colors, 2 that say "BM" at the start, not sure what the other 12 are for) and the rest is uncompressed image data, starting at the bottom-left corner and going left to right, bottom to top. 4 bits are used for each pixel; it's a lot like Super Nintendo 4bpp sprites with a palette built in.

CJA, on Jul 7 2007, 04:20 PM, said:

Also, "80x50 MZM saved to..."?? Is it not saved in halfchars?


hmm... yeah. what it should really say is Xx(Y/2+(Y%2)). i might fix that some time
...but that also means that the mzm is saved twice as big as it should be. I'll go fix that right now.

EDIT: Redownload. The bug should be fixed.

This post has been edited by Kuroneko: 08 July 2007 - 12:31 AM

"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

#17 User is offline   Dr Lancer-X 

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

Posted 08 July 2007 - 01:07 AM

Actually, you should be using more of the file format, because you don't know how big the header will necessarily be. That will depend on the application.

Use the header size field and the pointer to the bitmap field to work out where the palette and bitmap data are stored.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#18 User is online   Lachesis 

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

Posted 08 July 2007 - 01:23 AM

Lancer-X, on Jul 7 2007, 06:07 PM, said:

Use the header size field and the pointer to the bitmap field to work out where the palette and bitmap data are stored.

Oh, so THAT's what those 12 bytes are at the start
"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

#19 User is offline   Dr Lancer-X 

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

Posted 08 July 2007 - 01:24 AM

no, not all of them
look at the wikipedia page for device-independent bitmaps. it contains the full file format.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#20 User is offline   Nedemai 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 778
  • Joined: 15-December 04
  • Gender:Male
  • Location:Canada

Posted 10 July 2007 - 04:58 PM

Kuroneko, on Jul 7 2007, 03:41 PM, said:

asiekierka, on Jul 7 2007, 12:42 PM, said:

She didn't. :(

I specifically remember her talking about watching south park in mzx one day with a video to mzx engine she made

I was watching south park in MZX, but I had converted the audio to ogg and converted all the frames from the avi to tiny little bitmaps. It worked okay except the constant changing of the palette made the video flicker like crazy.

I haven't wrote anything to interpret AVIS in mzx.
0

#21 User is online   Lachesis 

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

Posted 10 July 2007 - 06:12 PM

Nedemai, on Jul 10 2007, 09:58 AM, said:

Kuroneko, on Jul 7 2007, 03:41 PM, said:

asiekierka, on Jul 7 2007, 12:42 PM, said:

She didn't. :(

I specifically remember her talking about watching south park in mzx one day with a video to mzx engine she made

I was watching south park in MZX, but I had converted the audio to ogg and converted all the frames from the avi to tiny little bitmaps. It worked okay except the constant changing of the palette made the video flicker like crazy.

I haven't wrote anything to interpret AVIS in mzx.

oh, my bad. xD
"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

Share this topic:


Page 1 of 1
  • 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