[HN Gopher] Show HN: 4K Desktop Wallpaper Generator
       ___________________________________________________________________
        
       Show HN: 4K Desktop Wallpaper Generator
        
       Author : roytanck
       Score  : 194 points
       Date   : 2021-11-28 12:55 UTC (10 hours ago)
        
 (HTM) web link (tanck.nl)
 (TXT) w3m dump (tanck.nl)
        
       | petepete wrote:
       | Works beautifully, I've saved a few for my rotation. Thanks!
        
       | sahiljajodia01 wrote:
       | This is amazing. However, how much is the probability for it to
       | generate the same wallpaper twice?
        
         | roytanck wrote:
         | Almost infinitely small. There are many random values used to
         | create the image, and most of those have millions of possible
         | values.
        
       | eins1234 wrote:
       | This 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 wrote:
         | Your 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 wrote:
           | Yeah but the problem is they don't otherwise support a
           | convenient desktop experience. Maybe next year will be the
           | year.
        
             | hnarn wrote:
             | >they don't otherwise support a convenient desktop
             | experience
             | 
             | I have no idea what this means.
        
               | artificial wrote:
               | Everyone assumes everyone shares the same values. I think
               | this person is dissatisfied with the UX on Linux.
        
               | hnarn wrote:
               | People conflating subjective opinion with objective fact
               | is in my opinion one of the most frustrating things about
               | Internet discourse today.
        
               | arthurcolle wrote:
               | no you're wrong
        
             | roytanck wrote:
             | This wallpaper generator was written on a Raspberry Pi
             | running Ubuntu. Which I use because of its highly
             | convenient desktop experience ;).
        
           | ExtraE wrote:
           | Still, the question remains. Why don't many/most/all?
        
         | smoldesu wrote:
         | My current desktop has an SVG as the wallpaper for my main
         | display and a webp on the second one. I guess I could switch
         | them over to a png or something, but I'm too lazy and I haven't
         | noticed any issues with it.
        
       | OJFord wrote:
       | Nice! 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 wrote:
         | 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.
        
           | bartvk wrote:
           | 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.
        
       | rob_c wrote:
       | Cool!
       | 
       | I wonder is the code public or just page source?
       | 
       | (Will have to check the page when not on mobile)
        
         | roytanck wrote:
         | The code is on Github: https://github.com/roytanck/wallpaper-
         | generator
         | 
         | Please let me know if you create something nice with it.
        
       | grech wrote:
       | Love 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
        
       | enz wrote:
       | Very nice. I now use one as my wallpaper. It's pretty satisfying
       | to know I have a uniquely generated wallpaper ;)
        
         | ajross wrote:
         | Ditto. 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.)
        
       | masteruvpuppetz wrote:
       | Can somebody recommend a free low poly background picture
       | generator? Example https://trianglify.io/
        
         | marban wrote:
         | Come on -- in the era of NFTs, $8 for an SVG is a steal.
        
           | pimlottc wrote:
           | I miss the old days of the internet when people would make
           | something like this just for fun, not to make a buck.
        
       | bit-101 wrote:
       | Nice work!
        
       | notRobot wrote:
       | Also see related: the soft landscapes twitter account:
       | https://mobile.twitter.com/softlandscapes
        
       | roland35 wrote:
       | My 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/
        
         | fuzzy2 wrote:
         | Oh, it's back? I was under the impression it was down for,
         | like, two years.
        
         | podiki wrote:
         | Yes, has some fantastic images, but seems nothing new for a few
         | years now.
        
       | qrohlf wrote:
       | Not entirely dissimilar to my own pattern generation tool,
       | https://trianglify.io/
       | 
       | How are you doing the color palettes? Is it fully random or using
       | some kind of picker algorithm?
        
         | roytanck wrote:
         | 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.
        
         | Starmina wrote:
         | Love it.
        
       | swayvil wrote:
       | Tasteful. Minimal. You are truly owning the zone.
        
       | [deleted]
        
       | oceankid wrote:
       | Super nice! Save doesn't work on Safari MacOS?
        
         | roytanck wrote:
         | 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.
        
           | dylan604 wrote:
           | macOS is not a mobile OS
        
             | roytanck wrote:
             | 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.
        
               | kkruglov wrote:
               | please, consider adding some kind of download button or
               | something for us, poor safari users <3
        
       | arendtio wrote:
       | Nice 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.
        
         | thamer wrote:
         | I 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, 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
        
         | Tepix wrote:
         | Instead of a seed you could create NFTs for every wallpaper to
         | finance the _insane_ server cost and for flexing of course ;-)
        
         | roytanck wrote:
         | 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.
        
       | FredPret wrote:
       | This 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.
        
       | bee_rider wrote:
       | A 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).
        
       | peanut_worm wrote:
       | You can't download the image on iOS
        
         | roytanck wrote:
         | 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).
        
           | 58x14 wrote:
           | I was able to download the image on iOS just now, using
           | Firefox on iOS.
        
             | 58x14 wrote:
             | It showed up in my camera roll immediately, which seemed to
             | ruin the joke until I read the explanation.
        
           | oefrha wrote:
           | 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.
        
       | kevmo314 wrote:
       | Love the simple, readable source compared to the compiled stuff
       | these days :) https://tanck.nl/wallpaper/wallpaper.js
        
       | stemlord wrote:
       | Anyone else remember digitalblasphemy.com? Good times
        
       | countmora wrote:
       | On 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
        
       | roytanck wrote:
       | I 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
        
       | rcarmo wrote:
       | Interesting. I used around 30-40 wallpapers generated through
       | Trianglify until recently, this has a lot of potential.
        
       | naikrovek wrote:
       | Tapet for Android is another example of this, and could serve as
       | great inspiration if you need any.
        
       ___________________________________________________________________
       (page generated 2021-11-28 23:00 UTC)