Lurker News

Comments (76) 29 threads

baldfat#
Would make scraping so much easier!
TazeTSchnitzel2 replies#
Oh, this is amazing.

I wondered how it figured out to use the elephant JPEG from the ASCII art. Well:

  def educated_guess_at_image():
      return 'http://pensivetoaster.com/wp-content/uploads/2013/05/elephant-banner.jpg'
(https://github.com/sigvef/sigvehtml/blob/e2cfa586f43aacbb374...)

Very xkcd 221.

iverjo1 reply#
I guess one could train a Convolutional Neural Network to convert the ASCII art to an actual image. Something like this, but for ASCII: http://sketchy.eye.gatech.edu/
cmiller1#
Wow, that works surprisingly well. I drew a terrible cat face, and it managed to get it dead on.
Rexxar4 replies#
It looks nice but the SVG generated seems incredibly big. Every ascii characters seems to be replaced by one svg element.

(You can have a hint at this behaviour because some pixel are "more black" when an area is covered by two SVG elements)
edit: killercup as made a similar comment with answer from the author, https://news.ycombinator.com/item?id=12621863

ivanceras1 reply#

   because some pixel are "more black" when an area is covered by two SVG elements
How can you possibly see that? This definitely needs a lot of more work on adding optimizer to reduce the elements into simplest form possible. Right now, this is just trying to put into screen what should it look like, it would be nice to have a more simplified SVG version up to primitive levels such as rect, circle, etc.
Rexxar3 replies#

    How can you possibly see that?
Short answer : I'm writing a drawing software and I've become pixel sensitive.

Technical answer : you are creating 1 pixel wide horizontal/vertical line with integer coordinates. Sadly in SVG this mean you writing your line between two pixel lines. So you don't write 1 black pixel but two semi-transparent black pixels. On white background the result is two RGB(127,127,127) pixels.
When two line overlaps you write semi-transparent black pixel twice and you end with two RGB(191,191,191) pixels.
You can hide this behaviour by shifting everything by 0.5 or using a retina display.

Continue this thread — 4 replies

Freak_NL#
> […] or using a retina display.

Any HiDPI display will work, not just Apple's. Shifting by 0.5 in both directions is a quick win though.

saidajigumi#
> using a retina display.

^^^ SO IMPORTANT. I returned to working with SVG seriously for a project last year, and was bitten by pixel-alignment rendering behavior along these lines. This was frustrating, as it was completely hidden during initial development by the fact that I was working on a retina-class display. On low-dpi, the rendering artifacts were quite noticeable. Compounding matters, the specifics varied by the SVG renderer (web browser) in use which also made it harder to identify the worst problem cases. Fortunately, it was noticed by an internal, design-sensitive user first!

skrebbel3 replies#
Is that a practical problem? Sounds like it would compress very well.
vertex-four#
Network isn't the only issue - speed of processing, and memory usage, are both things people should care about a lot more than they do.

This is equivalent to wrapping every character of your website's text in a div, precisely positioning it - at a large enough scale, or with a dynamic page, it's just eventually going to cause performance issues or even lock-ups.

artursapek#
SVG images with lots of small individual objects don't perform very well (processing & rendering).
XaspR8d#
I dunno -- it was visually apparent to me immediately when I opened the page. I thought it was maybe a deliberate "dotted-line" effect at first.
chib#
line { shape-rendering: crispEdges; }

This gets rid of the "more black" problem, but you lose the antialiasing effect which makes shapes with curves look horrible. Could try and apply it to only straight lines I suppose?

zokier2 replies#
In the "Safety-Control" chart, C++ is turned into C. That seems like fairly major problem
ivanceras#
Yep, has a lot more to do :(
Iv#
Or, alternatively, a pretty bold statement.
Animats2 replies#
Years ago I had a program that turned ASCII diagrams like that into line drawing characters.

    ┏━━━━━━━━━━━┓  ┏━━━━━━━┓
    ┃ Like this ┣━━┫  Box  ┃
    ┗━━━━━━━━━━━┛  ┗━━━━━━━┛
It's an easy transformation. You only have to look at 3 lines at a time, and then only at 3x3 blocks of characters. This would be a fun transformation to put in a text editor.

The line drawing characters in Unicode (and originally on the DEC VT100) aren't expressive enough. They lack arrows and round corners. With SVG, you can do more.
There are a lot of people who just can't use a draw program. Not sure why. I use Inkscape for this sort of thing, or sometimes LibreOffice Draw.

black_knight#
I keep the Unicode box drawing characters in my XCompose configuration. For example the sequence 〈ComposeKey〉 〈#〉 〈-〉 〈-〉 produces ━ (The thin horizontal line). Not too difficult to type, even compared to the ascii approach. Also quite easy to remember — the # looks like a box, so all the box drawing sequences start on it.
l_zzie2 replies#
Emacs has this: org mode and Dita.
jasonm23#
And aa2u

Load more comments