top | item 33561232

Show HN: A little side project, a watercolor art generator

224 points| nfriend | 3 years ago |brushify.art

Hi HN - this is a little side project I threw together. Some implementation details: image processing is all done with headless GIMP (running inside a Docker container) through its built-in Python API. It's _very_ slow (about 50 seconds/image), and currently it processes exactly one image at a time. The website is built with NextJS; payments are processed by Stripe.

I've had the best results with pictures of houses, although certain photos of people or nature can look neat, too. (For example: https://brushify.art/s/ruYmQWk, original photo from https://en.wikipedia.org/wiki/Pillars_of_Creation.) The effect obscures the edges of the photo, so images with plenty of margin around the subject work best.

Something I'd like to play around with is swapping the GIMP script for an AI-based process (maybe using something like Stable Diffusion?), with the goal of generating images that look more handmade (something like these: https://www.etsy.com/ca/search?q=watercolor+house). I have exactly zero AI experience though, so there would be a bit of a learning curve.

Would love any thoughts or critiques!

----

edit: remove unrelated details

71 comments

order
[+] rikroots|3 years ago|reply
Creating a watercolor filter which can be applied to an image dragged into a website <canvas> element is on my list of Fun Things To Do Over The Holidays - but having previously looked at the the mechanics that need to feed into the filter ... well it looks like I'd be jumping down a rabbit hole of complex maths and generative art approaches[1][2]. It's a complex problem space and I'm not sure I have the brain power and tenacity to do a good job of it.

[1] - Tyler Hobbs (2017) - a guide to simulating watercolor paint with generative art - https://tylerxhobbs.com/essays/2017/a-generative-approach-to...

[2] - Curtis|Anderson|Seims|Fleischery|Salesin (undated) - Computer-Generated Watercolor - https://grail.cs.washington.edu/projects/watercolor/paper_sm...

[+] ikkjo|3 years ago|reply
I guess you are right, the rabbit hole is quite deep. I spent a long time in it to make my own side-project: https://rembrob.com/

It is loosely based on the process described here: https://yunfei.work/watercolor/watercolor_pp.pdf and I though this can't be too hard...

I found it challenging to combine high resolution results with reasonable processing times.

[+] kuu|3 years ago|reply
My recommendation: Add examples on the main page, so the new users don't need to overload your site.

Otherwise the process is the following:

I enter the page -> Upload image -> See 4h of queue for getting my result -> I close the tab, leaving there a pending task.

[+] synapticpaint|3 years ago|reply
It sounds like your app turns photos into a watercolor style image? You can definitely do this faster with Stable Diffusion (~6s per image before optimization).

Here's how I would approach it: train a dreambooth model on watercolor style images, then run image-to-image using that model.

For examples of what dreambooth models can do see: https://synapticpaint.com/dreambooth/info/ (sample images here generated using a "modern disney" style model).

If you need help getting this set up feel free to email me! This stuff is probably not harder than getting gimp to run in a container.

[+] wongarsu|3 years ago|reply
Stable Diffusion on beefy hardware is faster than OPs process in OPs docker container, but I don't think we can judge from this that OP uses a slower process. For all we know this is running on the equivalent of a $10 Digital Ocean droplet.
[+] nfriend|3 years ago|reply
Very interesting, I will look into this! Thanks!
[+] rlv-dan|3 years ago|reply
This comment make me sad. Replacing human creativity with "ai" is like we've reached the peak so no need to put any effort into life anymore..
[+] nfriend|3 years ago|reply
Sorry all for the long wait times! Was not expecting much interest. At the very least, I need to look into removing photos from the queue when people exit the page.
[+] selcuka|3 years ago|reply
I wouldn't even let people add new images to the queue if the wait period is over, say, 10 minutes.
[+] wishinghand|3 years ago|reply
How is the image processing being done? In broad strokes, what're you doing with the Python API?
[+] nfriend|3 years ago|reply
Moving it to a larger AWS instance - will be down for a few minutes!
[+] jansan|3 years ago|reply
It says I should keep that tab open for the next 17 hours. What happens if I still close it?

Congrats for the unexpected success :)

[+] tfsh|3 years ago|reply
The example looks cool, but I'm currently in an 11 hour queue :(

Any chance of porting this to the web using WASM? I've used ImageMagick in the browser before, I've never used Gimp, but if there's enough overlap you could use the former. That's of course assuming two things:

1) you have the time

2) you're happy to port the closed source, source code to the client

Both of which are perfectly fine to answer with a "no" :)

Also, I think it would be prudent to terminate the request if the client instance is destroyed. Right now I assume there's a bunch of requests being processed for users who have closed the tab.

[+] andai|3 years ago|reply
Here's a suggestion, port it to run in the browser. Free parallelism, because every user brings their own hardware :) So it scales infinitely, for free.
[+] jasonjmcghee|3 years ago|reply
Fortunately OP, experience with AI is generally unrelated to success with Stable Diffusion / DALLE.

What you want to gain is experience with prompt engineering for these tools.

Here's a good resource https://openart.ai/promptbook

[+] bambax|3 years ago|reply
> I'd like to play around with is swapping the GIMP script for an AI-based process

Dall-e offers an API with some limitations (max 4MB square PNG, content filtering): https://beta.openai.com/docs/guides/images/usage

Photopea.com has a watercolor filter, in JS, all client side. It's not very good ATM so there's certainly room for improvement. Doing it all client side would solve the queue problem.

[+] gregoriol|3 years ago|reply
If you can make it with GIMP, you could probably look into OpenGL shaders to do it directly yourself: the processing could be faster and would provide you with more flexibility and coding fun times. I don't know of server-side libraries for that, but on iOS we have MetalPetal which provides some filtering features like ones in Gimp/Photoshop.

Have fun!

[+] ikkjo|3 years ago|reply
Would you be willing to share some details on the GIMP implementation? Are you actually generating brush strokes and "paint" the image or is it more filter based? The background effect looks like brush strokes to me, but are the details done in the same way?
[+] justchad|3 years ago|reply
Nice, this is really cool! I don't see myself waiting for my photo to process as it's a ~4 hour wait but the example image is cool.

Like you said I bet using Stable Diffusion would speed this up dramatically but who knows if you'll get the same effect on your images.

[+] _448|3 years ago|reply
In addition to upload/drop image, you could also provide an option to enter an URL of online image. That will make it easy for users to try the project very quickly. Then provide an ephemeral preview URL to see the output.
[+] yuvalkarmi|3 years ago|reply
This is super cool! Didn't know you could run GIMP in headless mode.
[+] seshagiric|3 years ago|reply
I understand it's a side project but you do have a paid offering. So I am curious what are you doing with the images after they are processed?
[+] asmosoinio|3 years ago|reply
Site seems to be down - could you post the example output on some image sharing site?

Seeing example output would be interesting, even if service is hugged to death.

[+] hollowdene|3 years ago|reply
Can't see myself paying $5.99 for one of these, but it's nice. I appreciated the fun messages in the progress bar.

PS: Congrats on the little one. :D

[+] iruoy|3 years ago|reply
It's not exactly a hug of death, but a wait time of 90m is a bit long. I hope that people that leave the queue won't be processed.
[+] _dan|3 years ago|reply
Perhaps put the wait time on the homepage - If I'd known you were running at an 8 hour delay I wouldn't have added to it!