8 ms·
Show HN: 4K Desktop Wallpaper Generator
- sahiljajodia01 5y agoThis is amazing. However, how much is the probability for it to generate the same wallpaper twice?
- roytanck 5y agoAlmost infinitely small. There are many random values used to create the image, and most of those have millions of possible values.
- FredPret 5y agoThis is just brilliant. I’ve been looking for ways to generate spanning wallpapers for two 4k screens, or two 4k’s + a laptop screen. Looks like this could be adapted for that.
- countmora 5y agoOn Safari (macOS) it is as impossible to download this easy-to-download-picture as it is possible to download the impossible-to-download-picture[1] from yesterday. [1] https://news.ycombinator.com/item?id=29358880 https://news.ycombinator.com/item?id=29358880
- sam0x17 5y agoLuckily the vast majority of MacOS users these days don't use Safari, for reasons like this
- bee_rider 5y agoIf you can't get the download to work, but are still interested in something similar, @victorgama put together what appears to be a pretty neat macOS implementation. It runs the algorithm on the desktop and automagically refreshes the wallpaper on startup, etc (unfortunately I don't know swift or have a mac, so this is just based on the readme). https://news.ycombinator.com/item?id=29377185 https://news.ycombinator.com/item?id=29377185
- roland35 5y agoMy favorite site for wallpapers is interface lift, but just note that the site does occasionally go down for months at a time! https://interfacelift.com/ https://interfacelift.com/
- peanut_worm 5y agoYou can’t download the image on iOS
- roytanck 5y agoThis 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).
- oefrha 5y agoYou 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.
- roytanck 5y agoThank 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.
- 58x14 5y agoI was able to download the image on iOS just now, using Firefox on iOS.
- 58x14 5y agoIt showed up in my camera roll immediately, which seemed to ruin the joke until I read the explanation.
- notRobot 5y agoAlso see related: the soft landscapes twitter account: https://mobile.twitter.com/softlandscapes https://mobile.twitter.com/softlandscapes
- bee_rider 5y agoA fun alternative would be to run this on the desktop and generate a new wallpaper every time your computer starts up (This is not a feature request, though -- you've had plenty of those here already, and since you've helpfully released the code under GPL, I'm sure anyone interested could easily do this conversion on their own end).
- victorgama 5y agoDone! (For macOS) https://github.com/heyvito/kabegami https://github.com/heyvito/kabegami
- bee_rider 5y agoYou've added some thoughtful features. I don't have a mac, but hopefully people will check this out.
- roytanck 5y agoI created a little web page (<10kB) that generates a random 4K (3840*2160px) wallpaper image using Javascript and the <canvas> element. Right-click to save the image (desktop only for now). No two images are the same. You may need a few refreshes to get an interesting result. Code: https://github.com/roytanck/wallpaper-generator https://github.com/roytanck/wallpaper-generator
- arendtio 5y agoNice idea. Ideas for optimization: - use some kind of seed from a URL, so that people can share them. - How about multi-monitor setups? The multi-monitor setup is something I struggled a bit. My two monitors are stacked vertically. So I use SVG images, render them in 2x4k height + 80px or so and cut the relevant parts out.
- roytanck 5y agoThe 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.
- Tepix 5y agoInstead of a seed you could create NFTs for every wallpaper to finance the insane server cost and for flexing of course ;-)
- thamer 5y agoI would also second the idea of putting the seed in the URL, even with just an anchor link so that all processing is done in the browser. So if someone visits https://tanck.nl/wallpaper/#12345 https://tanck.nl/wallpaper/#12345, use this number as the seed. You could also add a link under the image. edit: here's a hacky way to do it, since you can't seed Math.random() in JavaScript; add this at the start of the "draw()" function. const url = new URL(location.href); const match = /#([0-9]+)$/.exec(url.hash); if (match) { var seed = parseInt(match[1]); Math.random = function() { var x = Math.sin(seed++) * 10000; return x - Math.floor(x); }; } Based on a StackOverflow answer to the commonly-asked question of how to seed the PRNG in JavaScript, by all means not a perfect solution but appropriately concise for this short script: https://stackoverflow.com/a/19303725 https://stackoverflow.com/a/19303725
- ralusek 5y agoBut that wouldn't be cryptographically secure. Someone could deterministically predict my wallpaper for fuck's sake.
- kevmo314 5y agoLove the simple, readable source compared to the compiled stuff these days :) https://tanck.nl/wallpaper/wallpaper.js https://tanck.nl/wallpaper/wallpaper.js
- OJFord 5y agoNice! Feature suggestion: an (optional) colour picker would be a nice touch, so you can pick (or perhaps enter #RGB) one that should appear and the others are then a fitting palette. Occurred to me because I was refreshing through a few, liked the colours on one, but not so much the pattern. (Perhaps alternative implementation would be a 'hold colour palette' or 'hold pattern' toggles, so only the other varies.)
- roytanck 5y agoThank 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.
- bartvk 5y agoWhat 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.
- Bedon292 5y agoI 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.
- okramcivokram 5y agoI've added GUI where you can also pick the color and play around with other params. Check it out in this branch: https://github.com/markomarkovic/wallpaper-generator/tree/gui https://github.com/markomarkovic/wallpaper-generator/tree/gu...
- masteruvpuppetz 5y agoCan somebody recommend a free low poly background picture generator? Example https://trianglify.io/ https://trianglify.io/
- bit-101 5y agoNice work!
- oceankid 5y agoSuper nice! Save doesn't work on Safari MacOS?
- roytanck 5y agoUnfortunately, 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.
- rcarmo 5y agoInteresting. I used around 30-40 wallpapers generated through Trianglify until recently, this has a lot of potential.
- eins1234 5y agoThis is really cool! Thanks for sharing! Though one question popped up in my mind while looking at this... Given the trend of ever increasing screen resolutions with no end in sight, why don't OSes support using vector images (svg, etc) as wallpapers?
- hnarn 5y agoYour claim that no operating systems support this seems extremely unlikely. I’m pretty much certain there are multiple Linux desktop environments that support vector based background images.
- coolso 5y agoYeah but the problem is they don’t otherwise support a convenient desktop experience. Maybe next year will be the year.
- hnarn 5y ago>they don’t otherwise support a convenient desktop experience I have no idea what this means.
- artificial 5y agoEveryone assumes everyone shares the same values. I think this person is dissatisfied with the UX on Linux.
- hnarn 5y agoPeople conflating subjective opinion with objective fact is in my opinion one of the most frustrating things about Internet discourse today.
- arthurcolle 5y agono you're wrong
- grech 5y agoLove the minimalist execution. Personally, I consider your tool having no user-facing options a plus (less decision making for me and excitement from complete randomness). I just set one of the wallpapers as my desktop background. Thank you
- qrohlf 5y agoNot entirely dissimilar to my own pattern generation tool, https://trianglify.io/ https://trianglify.io/ How are you doing the color palettes? Is it fully random or using some kind of picker algorithm?
- naikrovek 5y agoTapet for Android is another example of this, and could serve as great inspiration if you need any.
- enz 5y agoVery nice. I now use one as my wallpaper. It's pretty satisfying to know I have a uniquely generated wallpaper ;)
- ajross 5y agoDitto. It's been a while with the same gradient. Reloaded a few times to find one with the general color space I wanted. Boom, done. I love it. (Needs a tip jar or something though.)
- petepete 5y agoWorks beautifully, I've saved a few for my rotation. Thanks!
- rob_c 5y agoCool! I wonder is the code public or just page source? (Will have to check the page when not on mobile)
- roytanck 5y agoThe code is on Github: https://github.com/roytanck/wallpaper-generator https://github.com/roytanck/wallpaper-generator Please let me know if you create something nice with it.
- swayvil 5y agoTasteful. Minimal. You are truly owning the zone.
- deleted 5y ago[deleted]
- stemlord 5y agoAnyone else remember digitalblasphemy.com? Good times
- taejavu 5y agoOh, with the glowing mushrooms (plus plenty of other abstract/fantasy landscapes)? Damn that takes me back
- unethical_ban 5y agoStill there!
- chubs 5y agoMy favourite part of this is that the wallpapers will look super sharp on my 4k display. It's quite difficult to find wallpapers that don't look blurry when blown up, even quality landscape photography. Very neat! Thanks for sharing :)
- GekkePrutser 5y agoThe colour schemes and limited amount of colours reminds me of the old VUE and CDE backgrounds :) And that reminds me of xfishtank. I still use that sometimes for old school cool and also because it is pretty optimized (when it was written many X terminals shared a 10mbit coax) and great way to see if a remote X desktop session is still responsive.
- nvaider 5y agoThis is great for rotating my lockscreen backgrounds
- batuhandirek 5y agoNot entirely same, but I have a similar project at https://circles.gallery https://circles.gallery Love the minimalism in yours! Maybe I should also put a URL for generating a single image like /random Thank you a lot for this :)