OAWP / OAWP

OAWP - Render animated wallpapers
GNU General Public License v3.0
1 stars 0 forks source link

Auto-imagemagik #3

Open TheRealOne78 opened 1 year ago

TheRealOne78 commented 1 year ago

Detect all .gif files and get every frame from gif, convert it and put them in a custom directory with a user prompt where it asks what directory and what kind of file.

Numerical auto-sort all the files as 00..., 01..., 02... ... etc in order for xawp to know what order to play the files

Old issue: https://github.com/TheRealOne78/XAWP/issues/4

TheRealOne78 commented 7 months ago

Convert gif to multiple images

As a manual workaround, you can simply the following command:

IM_SOURCE="input.gif"  # set IM_SOURCE as the input file
convert -coalesce "${IM_SOURCE}" %0$(($(identify "${IM_SOURCE}" | wc -l | wc -c)-1))d.bmp # convert
unset IM_SOURCE        # clear up the IM_SOURCE envar

This will convert input.gif into multiple bmp files, in a sorted order.

Also don't forget to move the gif file from the animated wallpaper directory.

Check gif framerate in seconds

  1. Use identify to see each image's framerate
    identify -format "%T\n" input.gif

    This should print out a bunch of lines containing a number. Each line represents a frame, and each frame has it's own wait time.

NOTE: Some wait times can differ from each frame. For now, don't use animated wallpapers with a big difference in wait times between frames, as OAWP will treat them with the same wait time.

  1. Take the frame time and divide it by 100 Now take the wait time and divide it by 100. In the terminal, you can do that using bc:
    echo "scale=5; <number> / 100" | bc

    Here replace <number> with the aforementioned wait time. scale is also another variable that decides how precise the floating point number should be.