Hacker News new | past | comments | ask | show | jobs | submit | roytanck's comments login

Considering that your system, power supply, storage and connection won't be redundant, I would not recommend this if you want the website to have decent uptime.

The cost of a Pi would likely also pay for a decent low-end VPS for a years or so.


I know, but (1) it's not critical, and (2) come on! It's so fun and so web1, and I have a static IP! :)


I've done something similar in another project (avatar generator based on username). That code would always use a seed, and generate a new one when none was supplied.

The main issue I see is that all the non-random numbers in the code would need to remain fixed. I love tweaking those to improve the results. The link you'd share would have to be something like /v1/hash, where 'v1' is a folder with the 'frozen' version of the algorithm.

I also think the results would be less random/erratic, and since the images this generates are only around 150 kilobytes, they are also easy to share :).


I see you've added a sharing feature! Thanks for this.

It really says something about the elegance of the image generation algorithm when the sharing code is about as long as the code to generate images. I was surprised when I first saw this draw() function, only a few lines long. Great job!


This wallpaper generator was written on a Raspberry Pi running Ubuntu. Which I use because of its highly convenient desktop experience ;).


The code is on Github: https://github.com/roytanck/wallpaper-generator

Please let me know if you create something nice with it.


Almost infinitely small. There are many random values used to create the image, and most of those have millions of possible values.


Completely random. It picks a hue value (0-360) and then adds or subtracts a second random value from this for each layer. The maximum value of this increment is relatively small, so the colors are usually similar within the same image.


Unfortunately, no. There seems to be some issue with saving canvas elements as PNG on mobile browsers. Since the generated images are landscape aspect anyway, I didn't spend a lot of time figuring out exactly what's causing this.


macOS is not a mobile OS


My bad. Seems that a number of browsers block saving canvas elements as a security precaution. For now, I can only recommend trying a different browser as a workaround.


please, consider adding some kind of download button or something for us, poor safari users <3


Thanks to a very helpful contributor on Github, there's now a download link.


This unfortunately, is a known issue. I tried adding a download button, but that also only worked on desktop. Probably some browser policy thing. The same is true for Android (Chrome and Firefox Nightly).


You can convert the canvas to a Blob with HTMLCanvasElement.toBlob(), then create a blob URL from that with URL.createObjectURL(). You can then replace the canvas with an <img src="blob://...">, which can be long press saved; add a download button linking to that blob URL; or whatever. Works on all non-ancient mobile browsers I've tested.

Do note that Firefox’s privacy.resistFingerprinting can block you from reading canvas image data, giving you garbage instead, and the permission prompt is basically unnoticeable if the user isn’t actively looking for it.


Thank you. I tried to implement this, but I got empty/missing images on mobile browsers. It basically worked everywhere where right-clicking also worked. I'll look into it more when I have more time.


I was able to download the image on iOS just now, using Firefox on iOS.


It showed up in my camera roll immediately, which seemed to ruin the joke until I read the explanation.


Thank you. Those are great suggestions, but I also like the simplicity of it being completely random. Perhaps I'll do an interactive wallpaper designer at some point, where you're more in control.


I do like the simplicity of completely random, but my first instinct was definitely to want some sliders or toggles. Personally prefer desktops to be extremely dark, and many of them were nice, but way too bright on a section. User control would definitely end up with a different experience, and totally respect the simplicity.

Might end up tweaking it to my tastes and a few other resolutions, like for my ultra wide.


What could be nice, and not require user input, is detect whether the user has dark mode enabled, and then use that as an input variable.


The width and height can be changed in the code. If you also increase the number of layers (vertical) and line segments (horizontal) accordingly, you should be able to get similar results at different resolutions/aspects.


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: