|
1982
|
|
« Reply #1 on: May 28, 2012, 11:18:23 AM » |
|
Holy shit this is great!
|
|
|
Logged
|
|
|
|
JP
|
|
« Reply #2 on: May 29, 2012, 09:01:49 PM » |
|
sneak peek at raster image conversion:
|
|
|
Logged
|
|
|
|
JP
|
|
« Reply #3 on: June 03, 2012, 11:35:03 AM » |
|
Hi hi. I put up a new alpha build: http://code.google.com/p/vectorpoem/downloads/detail?name=edscii_alpha3.zipMany new things since the last build, like cut/copy/paste and being able to resize the window. The most notable new feature though is, as sneak-previewed above, raster image conversion: To be clear, this works with arbitrary character sets and color palettes... EDSCII goes through the source image block-by-block and determines the best possible character and color combination to use. This is actually way more sophisticated than any ASCII conversion algorithm that I know of - which all just map a blocks's aggregate value to one character from a hardcoded ramp of 8-10 characters - none of which really take into account the shape of the character pixel-by-pixel. For those who care about technical details: the source image is first resized using PyGame's "smoothscale" function, which seems to be a generic bilinear resample. The image's pixel data is then converted into a list-based format for faster processing - PyGame's methods for dealing with pixel data are cumbersome and slow for this kind of work. The image is then converted into the L*a*b* color space for more accurate color comparisons - this makes for a huge improvement in quality. Next comes a standard Floyd-Steinberg dither, which for many but not all images makes for a nicer looking result - this is an option you can set in the imgconv.cfg file. The conversion is then done block by block while the application still runs, so you can see it in progress. Each character-sized block is considered against all relevant potential character + foreground color + background color combinations, and the character with the lowest pixel difference (in linear Lab colorspace distance) is created in place. At the end of this conversion you have a fully editable representation! Unfortunately, because this conversion process is so precise it is very slow, taking several minutes to convert larger images. I'll be looking for ways to optimize this.
|
|
|
Logged
|
|
|
|
cystem glitch
|
|
« Reply #4 on: June 03, 2012, 04:00:23 PM » |
|
that's really cool
|
|
|
Logged
|
You told me, never to limit myself to one style...to use any move that works...TO KEEP AN OPEN MIND!
|
|
|
Dane
|
|
« Reply #5 on: June 04, 2012, 12:19:17 PM » |
|
Really hot.
|
|
|
Logged
|
|
|
|
Endurion
|
|
« Reply #6 on: June 05, 2012, 09:09:15 AM » |
|
Neat. The PETSCII looks modified however, at least it doesn't match the C64´s Any chance to include the upper case PETSCII with the bigger range of graphic characters?
|
|
|
Logged
|
|
|
|
JP
|
|
« Reply #7 on: June 05, 2012, 10:15:06 AM » |
|
Neat. The PETSCII looks modified however, at least it doesn't match the C64´s Any chance to include the upper case PETSCII with the bigger range of graphic characters? Here's what the PETSCII character set image looks like: I'm pretty sure all the characters from the PETSCII set are included, though I could be wrong. The way I created it was, I took screenshots of the upper and lower case character maps from an emulator, compiled all the non-duplicates into one image, and then shuffled the layout so that similar characters were next to each other (you can see this most clearly with how all the different straight-line pieces are arranged). You can use q/w and shift-Q/W to move left/down and up/down through the map while painting. So the ordering of the characters is more or less arbitrary. When I write support for export to common ASCII formats (and possibly also C64 .PRGs for authentic demos!) I'll make sure this gets sorted into the order the actual native character set uses.
|
|
|
Logged
|
|
|
|
Endurion
|
|
« Reply #8 on: June 05, 2012, 10:19:10 AM » |
|
Ah, I mistook the second screenshot for being PETSCII, my mistake The image you showed there seems to be the complete set of unique characters from both lowercase/uppercase already. Good one! Played around with it, neat! ImageShack doesn't seem to work, so here: http://imageshack.us/photo/my-images/823/edscii.pngIs there an image export? <Nerd mode> The palette is weird (for the C64), white doesn't look white; also the color ordering is weird. Also, would be neat to have a mode where the proper restrictions of the machine apply </Nerd Mode> Once it crashed when I pressed the right mouse button (right at the start), other than that it was quite solid. Middle mouse button is offputting, I usually don't like when the wheel is misused as button. It happens to easy accidentally. Nice work!
|
|
« Last Edit: June 05, 2012, 10:43:40 AM by Endurion »
|
Logged
|
|
|
|
Pineapple
|
|
« Reply #9 on: June 05, 2012, 01:33:13 PM » |
|
this looks awesome, and incited me to write something similar for my own ansi graphics bit
will report back if I can actually get the damned algorithm to work correctly (which is getting shit done at a speedy 3ms/tile, and the issues should not be to do with what makes it so snazzy)
|
|
|
Logged
|
|
|
|
JP
|
|
« Reply #10 on: June 05, 2012, 02:59:28 PM » |
|
<Nerd mode> The palette is weird (for the C64), white doesn't look white; also the color ordering is weird. Also, would be neat to have a mode where the proper restrictions of the machine apply </Nerd Mode>
Yeah, it's a bit difficult to come up with a canonical C64 palette. The one I'm using is sourced from this classic image: which is also what my forum+twitter avatar icon uses. This guy did some really interesting work to get an accurate hardware-sourced C64 palette, but the white on it seems very dim and the value separation of the greys is off. I might try to make a hybrid palette based on that and the current one. BTW, all you have to do to use an alternate palette is drop an 8-bit PNG file into the pal/ subdirectory, and then inside the program press TAB to bring up the command line, then type "pal mypal" where "mypal.png" is the name of your palette image. The readme has some more info. Is there an image export?
Yes, try "export filename" at the command line, where "filename" is the name of the file you want to save. That will produce a native-resolution PNG. Once it crashed when I pressed the right mouse button (right at the start), other than that it was quite solid. Middle mouse button is offputting, I usually don't like when the wheel is misused as button. It happens to easy accidentally.Nice work!
I need to spend some time hunting down crashes. What are you using the middle mouse button for? I designed the app to mainly use left and right mouse buttons, but I'm using raw SDL button numbers, so that may correspond with different buttons on different systems.
|
|
« Last Edit: June 05, 2012, 03:14:48 PM by JP »
|
Logged
|
|
|
|
Endurion
|
|
« Reply #11 on: June 06, 2012, 05:52:39 AM » |
|
Copy/Paste requires the middle mouse button.
|
|
|
Logged
|
|
|
|
Pineapple
|
|
« Reply #12 on: June 06, 2012, 06:04:45 AM » |
|
|
|
« Last Edit: June 06, 2012, 12:01:24 PM by _Madk »
|
Logged
|
|
|
|
JP
|
|
« Reply #13 on: June 06, 2012, 12:23:57 PM » |
|
Copy/Paste requires the middle mouse button.
Ah yes. The usual CTRL-X, CTRL-C, and CTRL-V also work for cut, copy, and paste, respectively. Awesome to see people doing art with it!
|
|
|
Logged
|
|
|
|
JP
|
|
« Reply #14 on: June 06, 2012, 12:27:12 PM » |
|
My results are much less precise, but they're also quite quick. If you're interested in the particular algorithm I'd love to share and try to improve upon it. Note that increasing palette size is going to also increase running time.
Really, really awesome! It looks like you're matching colors and characters separately, which is smart - 1-bit comparisons are much faster. When I profiled my algorithm a lot of the time was taken up with simple square root calculations, used for the L*a*b* color difference checks, one for each pixel in the block. What's cool is that each algorithm has its own aesthetic, adding its own weird details. And because the output data is common to all of them, there's no reason you couldn't take the best bits from each for a piece.
|
|
|
Logged
|
|
|
|
Pineapple
|
|
« Reply #15 on: June 06, 2012, 01:36:12 PM » |
|
I'm not sure how viable it would be to combine the two, I think they work pretty differently. Anyway, a rough description of the algorithm.
note: "Luminosity" refers to red*3+green*6+blue
- Make an initial pass to store information about the on/off bits of the tileset in an array for quick access
For every block in the image which is to correspond to some tile:
- Make an initial pass over each pixel to store the block's color information in arrays for quick access, also compute the lowest and the average luminosity of the block
- Check every tile against the block to discover which has the fewest bits which differ from the block where a luminosity above the target ((average*7+lowest) shr 3) should be an on bit and lower or equal should be an off bit. An exact opposite is considered to fit just as well as an exact match to account for that colors can be alternated.
- Simultaneously (but independently) determine which of all the colors in the palette results in a closest match for the foreground and the background (with colors scaled for luminescence such that a difference in green carries twice more weight than a difference in red which carries thrice more than a difference in blue)
|
|
|
Logged
|
|
|
|
JP
|
|
« Reply #16 on: June 08, 2012, 07:48:39 PM » |
|
New alpha here: http://code.google.com/p/vectorpoem/downloads/detail?name=edscii_alpha4.zipThis is the first windows build with the image conversion stuff. Plus I fixed all the non-minor bugs I could find. It's in pretty good shape, so I'm going to leave it alone for a while and focus on other projects. Do tell me what you think, and where it's lacking. Thanks!
|
|
|
Logged
|
|
|
|
Kaelan
|
|
« Reply #17 on: June 08, 2012, 08:51:48 PM » |
|
MSVCR71.dll is missing for the windows build. EDIT: Also I keep getting crashes when I try to use the conv command: Traceback (most recent call last): File "edscii.py", line 2593, in <module> input() File "edscii.py", line 2244, in input app.commandline.input(event.key, ctrl, alt, shift) File "edscii.py", line 1519, in input self.run_command() File "edscii.py", line 1502, in run_command self.parse_command() File "edscii.py", line 1653, in parse_command if i.image: AttributeError: ImageConverter instance has no attribute 'image'
|
|
« Last Edit: June 08, 2012, 09:01:30 PM by Kaelan »
|
Logged
|
|
|
|
JP
|
|
« Reply #18 on: June 08, 2012, 10:10:49 PM » |
|
MSVCR71.dll is missing for the windows build. EDIT: Also I keep getting crashes when I try to use the conv command: Traceback (most recent call last): File "edscii.py", line 2593, in <module> input() File "edscii.py", line 2244, in input app.commandline.input(event.key, ctrl, alt, shift) File "edscii.py", line 1519, in input self.run_command() File "edscii.py", line 1502, in run_command self.parse_command() File "edscii.py", line 1653, in parse_command if i.image: AttributeError: ImageConverter instance has no attribute 'image' D'oh, I meant to fix that. It means the image conversion didn't initialize properly, for some reason - possibly as simple as file not found. If you can run from source, try adding this line right after line 347 of imgconv.py:
|
|
« Last Edit: June 08, 2012, 10:18:35 PM by JP »
|
Logged
|
|
|
|
|