dMZX Forums: MegaZeux Image Resampler - dMZX Forums

Jump to content

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

MegaZeux Image Resampler :frostyangel:

#1 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 03 June 2012 - 04:30 PM

So last night I got bored and came up with a silly idea for a potentially useful tool, so here it is. It's probably got a ton of bugs, but I got it working on a handful of images so whatever. Hopefully someone will get some utility out of it! I may consider revamping some of the dithering functionality to make it a little better in the near future.

Posted Image
Download Here: http://www.bitoblivi...geResampler.exe

Find me on IRC if there's a problem, and if there's enough interest I'll post source and send it up to the Vault.

WTF is this?
I remember feeling frustrated that most character conversion tools were limited in size because they did not bother to try to reuse characters or use characters that are "close" to others. This does that.

How to use:
- Import PNG/JPG/BMP/GIF (basically anything GDI supports) with the Load Image button
- Set your desired target MZM size
- Click Resample
- Adjust pixel diversity (and size if necessary), clicking Resample on each try, until the "Final" character count is below 255 (it will turn green and the export button will light up)
- Click Export to save out two files -- same stem name with two extensions (MZM and CHR)
- Import into MZX
- ???
- PROFIT!
0

#2 User is offline   ThDPro 

  • Brontosaurus-Sea-slug; Gooey and phallic
  • PipPipPipPip
  • Group: Members
  • Posts: 718
  • Joined: 03-December 06
  • Gender:Male
  • Location:Portland, OR

Posted 04 June 2012 - 08:20 AM

...

This

is

freakin

Awesome.

EDIT:
I do wish it would output partial charsets, though... but that'd kinda mess up the whole mzm thing... I dunno, just a thought.

This post has been edited by ThDPro: 04 June 2012 - 08:22 AM

original soundtracks
Better Than Nothing - DOMINATION - Commander Keen: Heroes Lost - Welkin - A Confectioner's Recipe - random ThDPro music stuff
<Risu21121> if you're not going to make a good game, you might as well make a blatantly racist one.
<Kuddy> Testicles.
"Where are my folder?" - KKairos
0

#3 User is offline   Dr Lancer-X 

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

Posted 04 June 2012 - 09:33 AM

View PostThDPro, on 04 June 2012 - 06:20 PM, said:

I do wish it would output partial charsets, though... but that'd kinda mess up the whole mzm thing... I dunno, just a thought.


I dunno, seems no reason why it couldn't. I created a similar tool in MZX that outputs MZM+partial charset for a project. It only reuses identical chars, though, not similar chars.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#4 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 04 June 2012 - 01:23 PM

If someone could point me in the direction of something that explains how partial character sets work from a file format perspective, that would be helpful (I just played trial and error for figuring out the CHR format anyways) ... I tried only writing out the first N characters and MZX seems to have just filled in the rest by itself. If I can get that working I'll toss that in.

I'm still trying to figure out a good way to do better similarity checking (since right now on some images it completely messes up and makes it look much worse than I feel it should) and I'll probably add some sort of Color->Mono dithering instead of just a 1bpp conversion (since I'm fairly positive, given the results, that GDI is essentially using a rudimentary canny edge detection algorithm to draw out the boundaries). Depending on how bored I get, I might decide to expand it further, so ideas are welcome.
0

#5 User is offline   Lachesis 

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

Posted 04 June 2012 - 04:02 PM

Partial charsets are the same format, and just have less chars than normal char sets. You'll need to specify an intended offset in the converter and then the user will need to put the partial char set there.
"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

#6 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 04 June 2012 - 05:06 PM

New version will be coming in the next couple days. Updates follow (pending edits as I go):
- Fix render bug with pixel sizes not calculating fill position
- Add partial charset export ability
- Lower-resolution UI dialog
- Color-coding of unique characters to see a big-picture of character reuse
- Clickable result image to see what characters are being reused with the clicked character

The feedback is appreciated!
0

#7 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 05 June 2012 - 01:58 PM

New (somewhat interim) version up. This fixes a bunch of problems that were rendering-related and adds the following features:
- Partial charset export
- New dialog layout
- Fine-tune editing of characters in-program
- Color-coding characters to show where they are being reused
- Clicking into result image to select a character, selects all identical characters

Version 1.1 Downloadable here: http://www.bitoblivi...ampler_v1.1.exe

Once again, bug reports and feature requests are welcome!
0

#8 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 11 June 2012 - 10:35 PM

1.1.5 (another interim release, I'm lazy) is here with the most-requested feature: dithering. That's the only difference between this and 1.1, and it's optional at that.

How do you use it? Load an image, if the image is >1bpp, the program will ask if you want to dither or not.

Dithering makes it harder to reuse characters, so tread carefully! (I plan to resequence the character editing with the reuse of characters to fix this)

http://www.bitoblivi...pler_v1.1.5.zip
0

#9 User is offline   Old-Sckool 

  • megazeux breaker
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 07-June 05
  • Gender:Male

Posted 13 June 2012 - 02:30 AM

Found a few bugs.

Sampling, resizing the mzm dimensions, and re-sampling again causes the image quality to degrade, even if you revert back to the default dimensions and resample.

On a fresh start click "Load Image", and close the pop-up that appears. An unhandled exception will occur if no image is already loaded. If one exists, the dithering option can be changed here.
<Nadir> mzxers don't make GAMES, usually
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D

<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
0

#10 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 20 June 2012 - 02:57 AM

There will be a bit of a lag in development here, as I've picked up a non-MZX personal project as well to hone my "reverse engineering devices" skills (the post for which can be found elsewhere on this board).

Feature additions to target for next version:
- Stacking adjustment commands
- Palette integration
- Different "similarity weighting" mechanism to choose from
- Better character reuse on the dithering algorithm
- Character set overlapping (add MZX default, alphabet, etc etc)
- Better graphics/rendering/optimization speed (F U GDI)

Things that are likely to also be in there:
- Mono support for Linux users
- Color dithering algorithm
- Full-screen-image mode

Things that may be in there, but probably not:
- Write canny filter to replace the shitty 50/50 1bpp conversion
- Edge smoothing
- Batch mode

Things that won't be in there for sure:
- Forth codes (regardless of how well they do keys)
0

#11 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 23 June 2012 - 10:59 PM

Notes on what's finished:

Quote

Feature additions to target for next version:
- Stacking adjustment commands New architecture makes this much easier.
- Palette integration
- Different "similarity weighting" mechanism to choose from Re-implemented quadrant-based density comparison, hopefully it will work properly this time.
- Better character reuse on the dithering algorithm See above; hopefully this will help with character reuse on dithering.
- Character set overlapping (add MZX default, alphabet, etc etc)
- Better graphics/rendering/optimization speed (F U GDI) Added character cache-back to fix this somewhat, eliminating a few tight loops.

Things that are likely to also be in there:
- Mono support for Linux users It took another UI redesign, but this version is geared around a Mono compatibility target.
- Color dithering algorithm
- Full-screen-image mode

Things that may be in there, but probably not:
- Write canny filter to replace the shitty 50/50 1bpp conversion
- Edge smoothing
- Batch mode


I've been working on this to restructure it and clean up the functionality somewhat; execution flow was confusing and scattered. At this version, I'll be posting source code to Github.
0

#12 User is offline   GetDizzy 

  • Touch Fuzzy.
  • Group: DigiStaff
  • Posts: 3,567
  • Joined: 22-November 01
  • Gender:Other
  • Location:MA

Posted 21 January 2013 - 12:17 PM

Since the links to MZXImageResampler above have apparently been eaten by Shub-Internet, and CharCon Redux, a somewhat similar project by myself, has been officially closed... Have a link to the very last MZXImageResampler executable. Unfortunately I don't have the full ZIP file, but it works just fine like this anyway afaict.


MZXImageResampler
- Your Jumpy Neighborhood Admin

<@Tixus> Anyway, I set the year to 1988 for some reason.
<@Tixus> And set the microwave to run for a minute and 28 seconds.
<@Tixus> But it failed to send me back in time, and I was disappointed.
<Insidious> Tixus accidentally microwaved the 80s
<Insidious> that is my takeaway from this
0

#13 User is offline   GetDizzy 

  • Touch Fuzzy.
  • Group: DigiStaff
  • Posts: 3,567
  • Joined: 22-November 01
  • Gender:Other
  • Location:MA

Posted 06 February 2013 - 04:21 PM

Huh. I know this isn't being worked on but I've come across a very odd limitation with the version I posted above.


It won't let me use a starting character index higher than 100. Anything I put in higher than 100 becomes 100. This is even if the resulting image uses less than 155 characters (Mine used 79)

Very, very odd.

If MZXGiant still reads the forums, do you think you could enlighten us as to why you made that the limit?

For the curious, I'm trying to put two mzximageresampled images into one charset. One is about 20 characters and happily fits above the standard "letters" rows, and one is 79 characters and happily fits below them. I'd like to be able to export the charset starting at 128 so I can easily accomodate this without having to do any reshuffling inside MZX and while keeping my font.


EDIT: Wow... Starting character index is just BROKEN in general.

As an example, if you use a starting character index of 26... Instead of giving you a partial charset thats identical to one with a starting character index of 0 and giving you an MZM with everything adjusted so that p?? is +26 as expected, it instead gives you that MZM and a charset with 26 extra filled characters at the start!

Did MZXGiant not know you can load partial charsets with an offset??
- Your Jumpy Neighborhood Admin

<@Tixus> Anyway, I set the year to 1988 for some reason.
<@Tixus> And set the microwave to run for a minute and 28 seconds.
<@Tixus> But it failed to send me back in time, and I was disappointed.
<Insidious> Tixus accidentally microwaved the 80s
<Insidious> that is my takeaway from this
0

#14 User is offline   asgromo 

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

Posted 06 February 2013 - 07:49 PM

Quote

Did MZXGiant not know you can load partial charsets with an offset??

MERCY, WHAT A SCANDAL

GET ME MY SMELLING SALTS
2

#15 User is offline   Lachesis 

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

Posted 06 February 2013 - 10:08 PM

Instead of calling out all of this stuff maybe sending him a friendly PM would make him more immediately aware of the issues and more willing to fix them or at least post the source
"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

#16 User is offline   GetDizzy 

  • Touch Fuzzy.
  • Group: DigiStaff
  • Posts: 3,567
  • Joined: 22-November 01
  • Gender:Other
  • Location:MA

Posted 07 February 2013 - 04:05 PM

I've actually been told Thud already sent him a PM along these lines, so sending another one would probably just count as annoying him. :(
- Your Jumpy Neighborhood Admin

<@Tixus> Anyway, I set the year to 1988 for some reason.
<@Tixus> And set the microwave to run for a minute and 28 seconds.
<@Tixus> But it failed to send me back in time, and I was disappointed.
<Insidious> Tixus accidentally microwaved the 80s
<Insidious> that is my takeaway from this
0

#17 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 08 February 2013 - 11:46 PM

Updated source is on Github, but incomplete; http://www.github.co...ximageresampler

Source for release is here: http://www.digitalmz...sampler_src.zip
1

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