News for hackers. Stuff that matters.
Re:Show HN: Primitive Pictures by fogleman on Tuesday September 20, 2016 @02:10PM (#12541785)
Hi HN, OP here. I've tinkered with this problem a few times over the years, but only now am I happy with the results. This time I wrote it in Go and implemented things a bit differently that helped performance quite a bit.

I plan on implementing SVG output pretty soon. It won't be hard I just haven't done it yet.

For the Twitter bot, I'm planning on adding another mode where it posts a GIF showing the iterative progression of drawing an image.

Let me know if you have any questions or if you have ideas for other features!

Re:Show HN: Primitive Pictures by alejohausner on Tuesday September 20, 2016 @10:50PM (#12545050)
There is lots of work on "artistic rendering" like yours, from the early 1990s to the present. It started with work by Paul Haeberli at SGI [1]. The first chapter in "Image and Video-Based Artistic Stylisation", edited by Paul Rosin and John Collomosse [2] describes many techniques you might be interested in. Have a look; you will like what you see.

1.http://dl.acm.org/citation.cfm?id=97902

2.https://books.google.com/books?id=YjXlTPFYGEYC

Re:Show HN: Primitive Pictures by fogleman on Tuesday September 20, 2016 @11:02PM (#12545088)
Hey, that book looks right up my alley... I just ordered a copy. :)
Re:Show HN: Primitive Pictures by jotato on Tuesday September 20, 2016 @02:18PM (#12541865)
Do you have nay plans on putting a website front end on this? It would be great to upload an image and get a result
Re:Show HN: Primitive Pictures by fogleman on Tuesday September 20, 2016 @02:21PM (#12541900)
A few people have asked that, so maybe. Another thought was you could tweet an image to the Twitter bot and have it tweet back the result, but then your image is out there for the world to see, so maybe that's not as good.
Re:Show HN: Primitive Pictures by busted on Tuesday September 20, 2016 @03:42PM (#12542655)
If you create a frontend, it may be a good idea to add a button for buying a print (which you could do through one of the many online services available). Some of these look very nice and I'm considering printing something like this on a canvas to hang on the wall.
Re:Show HN: Primitive Pictures by OJFord on Tuesday September 20, 2016 @05:51PM (#12543720)
All the +1 in the world for this. I've been browsing the Twitter bot for a while just thinking "some of these are great; I'd happily hang one".
Re:Show HN: Primitive Pictures by baszalmstra on Tuesday September 20, 2016 @05:33PM (#12543619)
absolutely +1 for this
Re:Show HN: Primitive Pictures by antirez on Tuesday September 20, 2016 @03:35PM (#12542591)
I was about to create such a website a couple of years ago, but isn't this too much computational expensive to be a free service? It's going to make people wait a lot if the service hits HN or something like that. Or maybe my code was too much unoptimized and it's possible to train the images in a quite faster fashion after all. Anyway would be great to have such a site.

EDIT: Now I checked better your implementation and is very different, and indeed, can be made a lot faster. What I (and others before me) do is to have a fixed set of polygons and move, rotate, change color in order to find the best arrangement. In your case instead you add shapes incrementally in order to lower the error.

Re:Show HN: Primitive Pictures by shurcooL on Tuesday September 20, 2016 @06:38PM (#12543988)
Is it pure Go? Could you compile with GopherJS and do the processing all client side?
Re:Show HN: Primitive Pictures by fogleman on Tuesday September 20, 2016 @06:45PM (#12544024)
That would be cool. It is pure Go...
Re:Show HN: Primitive Pictures by tkxxx7 on Tuesday September 20, 2016 @02:34PM (#12542011)
I could see this becoming super popular in some twitter circles, though.
Re:Show HN: Primitive Pictures by MasterScrat on Wednesday September 21, 2016 @06:17AM (#12546832)
You could also make it an app the way Prisma did...
Re:Show HN: Primitive Pictures by overcast on Tuesday September 20, 2016 @04:20PM (#12543001)
Grab primitivepics.com NOW.
Re:Show HN: Primitive Pictures by tombrossman on Tuesday September 20, 2016 @05:25PM (#12543573)
Also available is primitive.pics. I'm surprised no one has grabbed these yet...
Re:Show HN: Primitive Pictures by rawnlq on Tuesday September 20, 2016 @05:36PM (#12543633)
That's a terrible name if he's planning to monetize this tho.
Re:Show HN: Primitive Pictures by blt on Tuesday September 20, 2016 @11:35PM (#12545200)
why?
Re:Show HN: Primitive Pictures by jerf on Wednesday September 21, 2016 @09:53AM (#12548135)
I assume because "primitive" generally has negative connotations. (Don't try to make rational arguments about that doesn't apply here or how obvious it is that it's not the "bad" sort of primitive. We're talking about marketing here. Rational arguments are a category error.) I'm not creative enough to come up with a positive, just some more neutral ideas that you would have the opportunity to shape, like Shapify (taken by other things though), something with "simplify", something with "fun" maybe ("fun up your photos!").
Re:Show HN: Primitive Pictures by overcast on Wednesday September 21, 2016 @10:21AM (#12548376)
And to me, Shapify is just another generic "web 2.0" name. Lost in the sea of a million other "ify" domains. The point here is that they should at least claim the domain name for their product, regardless if that is going to be the actual public facing product.
Re:Show HN: Primitive Pictures by jerf on Wednesday September 21, 2016 @12:32PM (#12549735)
This is another one of those "your tone suggests you disagree with me, but you're just repeating my point back at me" posts. I told you "Shapify" was a neutral word that you can pour your own connotations into. A lot of brands are. What's a "Cisco"? What's a "Nike" in a country where most people won't get the classical allusion? What's a "Coke"?
Re:Show HN: Primitive Pictures by overcast on Wednesday September 21, 2016 @01:41PM (#12550453)
Those brands aren't generic "ify" names that sound like they came from a domain name generator. Primitive sounds like a pretty good company name to me. There is already a skateboarding company of the same name that does well.
Re:Show HN: Primitive Pictures by oh_sigh on Wednesday September 21, 2016 @01:39AM (#12545689)
You could accept DMs as well
Re:Show HN: Primitive Pictures by gedy on Tuesday September 20, 2016 @11:55PM (#12545266)
This is great work! I've tinkered with another algorithm recently that gives similar results: http://imgur.com/a/djqnR

Will share another time, thanks again for the post.

Re:Show HN: Primitive Pictures by anilgulecha on Wednesday September 21, 2016 @02:21AM (#12545842)
Very cool. One variation I'd like to see in the same algorithm is without the padding or borders, just the gradient-ed quadrants.
Re:Show HN: Primitive Pictures by WoodenChair on Wednesday September 21, 2016 @01:59PM (#12550629)
Can you link to the algorithm itself? Thanks - cool work.
Re:Show HN: Primitive Pictures by lisper on Tuesday September 20, 2016 @05:56PM (#12543751)
This is really impressive. I'll bet if you printed these out as high quality giclees and didn't tell anyone how you did it you could sell them for thousands of dollars in fine art galleries.
Re:Show HN: Primitive Pictures by javajosh on Tuesday September 20, 2016 @07:13PM (#12544149)
I feel compelled to note that "giclée" is a fancy word for "inkjet printed". It has connotations of higher quality, but it's not a distinct process. See https://en.wikipedia.org/wiki/Gicl%C3%A9e
Re:Show HN: Primitive Pictures by lisper on Tuesday September 20, 2016 @07:18PM (#12544183)
That's not quite true. It's a particularly high quality of ink-jet print. You can easily tell the difference between a giclee and the output of an HP OfficeJet.
Re:Show HN: Primitive Pictures by TeMPOraL on Tuesday September 20, 2016 @07:42PM (#12544296)
Since we're talking art and commerce, I smell a business opportunity - selling inkjet printers with Giclée Enabled™ label, at extra markup.
Re:Show HN: Primitive Pictures by l0b0 on Wednesday September 21, 2016 @02:46AM (#12545937)
From Wikipedia (and professional photographers I've spoken to mirror this sentiment), “since [giclée] is an unregulated word it has no associated warranty of quality.” It's like “premium”.
Re:Show HN: Primitive Pictures by klodolph on Tuesday September 20, 2016 @08:13PM (#12544451)
It's still the same process. The printers used to make "giclée" printes are ordinary inkjet printers, they're just not HP OfficeJet printers—probably.
Re:Show HN: Primitive Pictures by lisper on Tuesday September 20, 2016 @09:05PM (#12544689)
Depends on what you consider "ordinary". A giclee printer can fill a room and cost many thousands of dollars. e.g.:

http://www.adorama.com/iesp20000.html?gclid=CNz7x4-in88CFQqE...

Re:Show HN: Primitive Pictures by klodolph on Wednesday September 21, 2016 @12:00AM (#12545279)
I have a similar printer.

The word "giclee" does not even appear in the description, but "inkjet" does. It's still an ordinary injet printer. It's bigger and more accurate than most. I've never seen them put in rooms so small that they'd "fill the room", I've usually seen them in rooms with several printers.

Re:Show HN: Primitive Pictures by lisper on Wednesday September 21, 2016 @01:12AM (#12545584)
> It's bigger and more accurate than most.

Then it isn't ordinary.

Re:Show HN: Primitive Pictures by glial on Tuesday September 20, 2016 @07:31PM (#12544251)
Also it's often done on some type of canvas.
Re:Show HN: Primitive Pictures by polyomino on Tuesday September 20, 2016 @06:38PM (#12543985)
You could probably sell them even though you revealed how you did it.
Re:Show HN: Primitive Pictures by seanmcdirmid on Tuesday September 20, 2016 @09:41PM (#12544844)
On a related note, perhaps Richard P Gabriel could also sell his machine generated poetry. The future will be interesting for artists.
Re:Show HN: Primitive Pictures by lisper on Tuesday September 20, 2016 @07:14PM (#12544157)
I dunno, I think a lot of the hoity-toity types who are willing to overpay for art would be put off by knowing that it was done by computer. For them, the value is in the scarcity more than the aesthetics: they want to have something that their friends don't (and can't!) have. So if it were me, I would choose not to reveal that anyone who knows how to use github and an inkjet printer can reproduce the results.
Re:Show HN: Primitive Pictures by jamesjyu on Tuesday September 20, 2016 @07:40PM (#12544288)
That's not necessarily true. There are many examples of fine art which is made by computer and easily replicated by anyone. However, the prints themselves are limited in quantity (or, there may just one official print).
Re:Show HN: Primitive Pictures by lisper on Tuesday September 20, 2016 @07:47PM (#12544325)
Of course. But do people pay top dollar for those? I don't actually know, but I doubt it.
Re:Show HN: Primitive Pictures by RangerScience on Tuesday September 20, 2016 @10:14PM (#12544933)
This is how photography nearly always worked. I think there's some early photo tech that did only result in one image, but all of film photography produced 'prints'.

Although I remember growing up with one print that deliberately had a fold in it, made by the artist as part of the art.

Re:Show HN: Primitive Pictures by bootload on Tuesday September 20, 2016 @09:28PM (#12544795)
"I dunno, I think a lot of the hoity-toity types who are willing to overpay for art would be put off by knowing that it was done by computer. For them, the value is in the scarcity more than the aesthetics:"

There is a portion of the art market that caters for interior design. A client might say something like, "I want a dozen in this colour, style with an ocean breeze feel." As soul destroying as this may be to an artist, some clients want their art by the numbers, colours and feel.

Re:Show HN: Primitive Pictures by ZenPsycho on Tuesday September 20, 2016 @09:34PM (#12544822)
I have tinkered with this myself. Have you tried a fitness function that doesn't just compare the source pixels, but also compares the source and approximation after each has been run through various convolution kernels, and adding the result to the overall score? it takes a little longer but it can let you fine tune things like giving a higher score to images whose edges line up.
Re:Show HN: Primitive Pictures by comboy on Tuesday September 20, 2016 @05:42PM (#12543667)
Make stroke of a brush a geometric primitive and you have an interesting painter.
Re:Show HN: Primitive Pictures by pbhjpbhj on Tuesday September 20, 2016 @06:21PM (#12543882)
I was thinking along those lines, perhaps a general swash shape that is randomised at the edges a little.
Re:Show HN: Primitive Pictures by fogleman on Tuesday September 20, 2016 @06:57PM (#12544067)
Yeah, I briefly thought about that but haven't tried anything yet...
Re:Show HN: Primitive Pictures by comboy on Tuesday September 20, 2016 @07:13PM (#12544144)
Great work so far, I hope you can pull it off.

... Then just come up with some fake name and portfolio website because I have a feeling that people will want to pay less for automatically generated art even if in a blind test they would like it more than a "real" one ;)

Re:Show HN: Primitive Pictures by bomdo on Wednesday September 21, 2016 @04:26AM (#12546361)
The code is very readable! Especially because it's not using a lot of external libraries. Including the twitter bot is a very nice touch. Awesome!

One of the key features of golang is concurrency. Your code is single-threaded, even though hill-climbing and annealing (and also all kinds of image operations) could be highly parallelized. Maybe that's something rewarding to look into at some point?

If you ever find the time, can you outline your strategy for your choosing a convergence algorithm? How did your experiments go for choosing the parameters (you called them maxAge, maxTemp, etc.) for those? Why did you currently end up choosing hill climbing over annealing, here: https://github.com/fogleman/primitive/blob/master/primitive/...

Re:Show HN: Primitive Pictures by tgb on Tuesday September 20, 2016 @07:22PM (#12544204)
I like it. I noticed that the oval brushes were almost always of lower quality (in the sense of doing a worse job recreating the original). I think it's because you only take axis-aligned ellipses and not arbitrarily rotated ones, which might be fun to try too.
Re:Show HN: Primitive Pictures by fogleman on Tuesday September 20, 2016 @07:27PM (#12544228)
Actually ellipses perform pretty well. I've analyzed this a good bit... http://i.imgur.com/82Aksg0.png (lower is better, this shows average score over 100 different input images)
Re:Show HN: Primitive Pictures by fitzwatermellow on Tuesday September 20, 2016 @07:12PM (#12544140)
Can't believe you didn't input Duchamp's Nude Descending A Staircase ;)
Re:Show HN: Primitive Pictures by tripzilch on Wednesday September 21, 2016 @04:17PM (#12551840)
I'd love to see this, please :)
Re:Show HN: Primitive Pictures by nathancahill on Tuesday September 20, 2016 @06:14PM (#12543845)
I'd love to help with the SVG implementation. I'll follow the repo. Great project.
Re:Show HN: Primitive Pictures by Ar-Curunir on Tuesday September 20, 2016 @07:41PM (#12544290)
As an aside, it would be nice if you could cite the original sources of the images posted by the Twitter bot; it would be nice to compare, and probably most safe legally too.
Re:Show HN: Primitive Pictures by Cogito on Tuesday September 20, 2016 @09:52PM (#12544870)
to add to this, I want to compare to the source image! You should definitely link to the original.
Re:Show HN: Primitive Pictures by epalmer on Wednesday September 21, 2016 @12:55PM (#12549985)
Thanks. This is wonderful. I just put go on my mac and got this running in ~5 minutes. I am going to do a few images tonight and will share the google photo album as a comment to this comment when I get a chance tonight.

This is very cool. Thanks.

Re:Show HN: Primitive Pictures by epalmer on Thursday September 22, 2016 @03:08PM (#12559352)
Not sure anyone will see this but I rendered some photos using this great tool. I like The Black Widow and the passage way the best.

https://goo.gl/photos/s7XMqTuVLayztEHf9

Re:Show HN: Primitive Pictures by bcheung on Tuesday September 20, 2016 @06:55PM (#12544061)
Nice work!

As far as other ideas, morphing from one photo to the next one. Making changes (morphing shapes, changing colors, adding / removing shapes) would look interesting.

Re:Show HN: Primitive Pictures by thatcat on Wednesday September 21, 2016 @03:02PM (#12551211)
I noticed that the alpha default is 128, but usually the scale is 0-1. Is the scale then 0 - 256 for this option?
Re:Show HN: Primitive Pictures by pRusya on Wednesday September 21, 2016 @03:12AM (#12546017)
Awesome! Thanks for sharing this. Feature request: combine modes(e.g. triangle+rect).
Re:Show HN: Primitive Pictures by joncalhoun on Tuesday September 20, 2016 @08:58PM (#12544659)
Just wanted to say this is really awesome. Nice work!