mczachurski / wallpapper

:computer: Console application for creating dynamic wallpapers for macOS Mojave and newer
MIT License
3.32k stars 137 forks source link

Images don't seem to cycle correctly #16

Closed NiccoloGranieri closed 3 years ago

NiccoloGranieri commented 6 years ago

Created a file with 16 images, and set it as wallpaper. Changing manually the time, the images don't seem to change with regularity as one would expect. Even if azimuth and altitude have been set from the suggested website. Any suggestion?

ctw-braun commented 6 years ago

watch here https://github.com/mczachurski/wallpapper/issues/12

tommyparker commented 6 years ago

I've been playing around with the azimuth and altitude data for a few days now and I think I've got it down more or less.

So my first step was to make my test colour palette (I'm making an illustrated wallpaper so I have that flexibility) and split a 24 hour day into the 16 images required by breaking it down into 1.5 hour palettes.

screenshot 2018-09-28 18 24 14

I then used www.suncalc.org to see which timeline closely matched mine by simply changing the date and checking the slider at the top of the screen.

screenshot 2018-09-28 18 21 57

After that, it was a simple case of using the altitude and azimuth data as the values for each interval.


    "fileName": "1.png",
    "isPrimary": true,
    "isForLight": true,
    "isForDark": false,
    "altitude": 15.42,
    "azimuth": 80.18,
    "time": "07:30 UTC+1"
JohnSlaughter commented 6 years ago

Wait... time is a value? Or is that for your internal use only?

tommyparker commented 6 years ago

Ah sorry, yes. Time is just an internal use value for my records.

ctw-braun commented 6 years ago

It's good to split a day into 16 images but i don't believe the time from dawn to sunrise isn't always 1.5 hours :) I wanna see to the closed time a picture from night to dawn to sunrise and then to the bright day :) I added also the json time value for internal use, because after a couple of time nobody knows on wich time is this. In my opinion it can't work correctly around the world without a reference to the log, lat.

"altitude": 15.42,
"azimuth": 80.18,

Nobody knows on which location this is and without a time value can you not say "ah this is at 12:00 in my region". I don't know how Apple this calculate but on all Websites where u can calculate the sunrise and sunset u must enter log, lat and a date/time value. This is the only way to get on a specific point the correct sunset time on a specific day. In my example i used the longest day of the year in my location 21. Jun 18 sunrise was around at 5:50 but now in September is the sunrise much later.

Also was it interesting which altitude and azimuth have i to use for the wallpaper? My location where i am or the pictures location on the day where i makes it? for example i have a holiday picture from australia and i life in europe there is a big time difference :) What do u think is to use for altitude and azimuth?

I believe if we share some of these new wallpapers and if we life in very different locations then we get the effect to see a daylight picture on night on our screen :)

tommyparker commented 6 years ago

The time and location is irrelevant as it's based on the position of the sun relative to the observer. Which means as long as you input the correct altitude and azimuth values, it'll work in sync with the daylight wherever you are.

Also, in theory, you could also do 1 main day image and 1 main night image and fill the remaining 14 image slots with a more detailed sunrise and sunset.

JohnSlaughter commented 6 years ago

I found that didn’t really work. I set up a test every 15 minutes and it still only updated every hour/hour and a half. It was a different image every time, the most accurate one for when it did finally change, but it just doesn’t check that often to use the extra images.

tommyparker commented 6 years ago

Ah that's a shame – would be nice to have a smooth sunset transistion.

JohnSlaughter commented 6 years ago

If we knew what daemon triggered the check, we might be able to get it to fire more often. At the very least restart it, which would force an update. (Changing the clock forces an update, so there is a way to trigger it.)

brandondadam commented 4 years ago

Has anyone discovered an issue when setting "isPrimary" in the JSON? IsPrimary seems to affect the sequence order, but I'm having trouble understand how. I even looked at how the sequence order was set in the generator file, and can't make sense of why isPrimary changes the images order.

I don't know if I just need proper documentation for the json properties, or if this is an issue related to images not displaying in order.

mczachurski commented 4 years ago

Picture which is marked as "isPrimary" must to be added to the heic file as a first picture. Thanks to this that picture is visible as thumbnail in operating system.

brandondadam commented 4 years ago

Awesome! That did the trick. Thank you!

For future reference, is there clearer documentation on the json properties anywhere? I'm getting pretty creative about what kind of wallpappers I'm creating and something detailing the json structure would be really helpful! For example, is there any specific order the isForDark property should be in? I can't figure that out with trial and error, and this way people might not make the same mistake.

vatologic commented 4 years ago

@brandondadam The date is in the ISO 8601 format. With date, time and UTC. The JSON examples mention only Zulu (Z) as the base, but that can be changed to +01:00 or whatever the UTC offset in your zone is.

I've noticed Mojave's wallpaper daemon (whichever one that may be) crashed when I used dates in the future, so I rigged my to be at least two days in the past.

For people that want the thumbnails to work in MacOS Mojave, here's a way:

  1. Save the wallpaper.heic file to /Library/Desktop Pictures (you need admin access). I know it's not the cleanest way - but that made the dynamic wallpapers show up with the proper 'dynamic' option in the dropdown menu when you change wallpapers.
  2. Install ImageMagick with Homebrew; brew install imagemagick
  3. Convert one reference frame to .heic; magick frame.png -resize 355x200! wallpaper.heic
  4. Move the thumbnail to /Library/Desktop Pictures/.thumbnails (it's a hidden folder)

The wallpaper itself and the thumbnail must have identical names. The resolution of MacOS's own thumbnails was 200 pixels high and 355 for the .heic files and 354 for the .jpg files. I've used the exclamation mark in the resize argument of ImageMagick since I just wanted to have some sort of reference, even though images may appear stretched in the preview - the wallpaper itself is unaffected. The reason why I didn't just made one in Photoshop; I wanted everything to come from one CLI script and I needed to have thumb creation on the fly.

mrmikeface commented 4 years ago

Thanks @vatologic, your comment about the thumbnails helped me realize that my heic weren't cycling because of the file name. Once I renamed them to Catalina.heic it cycled them fine even though they're outside the read only root. (In ~/Library/Desktop\ Pictures/Catalina\ {Left,Right}/Catalina.heic respectively)

You can confirm macOS is changing backgrounds based on messages from com.apple.dynamicdesktop in the Console.app