如何创建桌面壁纸幻灯片?

如何使用自己的图片集创建桌面壁纸幻灯片?
- 可以从图片文件夹中选择图片,或者预先选定图片 - 可以按顺序或随机显示图片 - 可以每隔几分钟或在随机时间后更换图片

42018年,Variety对我来说似乎是完成这项工作的最佳工具:https://peterlevi.com/variety/ - jmng
20个回答

如果你想用它来管理照片,并且喜欢简单易用的工具,我推荐使用默认安装的Shotwell
打开它:

open shotwell

选择您想要设置为背景幻灯片的照片:

select images

打开 文件设为桌面幻灯片 或按下 Ctrl+B:

set as slideshow

调整时间设置:

set time

完成。

10非常感谢!我喜欢这个解决方案胜过Wallch,因为你不需要安装任何额外的应用程序来达到相同的目的。 - Antony
4我需要为同一个事情创建一个创业申请吗?还是每次都会起作用? - ArunMKumar
5老帖子了,但在搜索中排名最高。 这绝对是最简单的方法。仍然完美运作,并且对于@Arun Kumar的问题,会自动加载,无需进一步操作。 注意:当尝试从符号链接导入图像时,我不得不通过选择文件夹来更改设置中的导入位置,否则将无法选择图像。 - u2n
1解决方案是随机显示图片还是按顺序显示?这些图片是放大的、填充的、跨越的或其他什么样的方式呢?它们能完美适应桌面吗? - abhishah901
这个功能有办法把照片设置为居中、缩放、放大、拉伸等吗?在偏好设置里我没有看到相关选项。 - Kalamalka Kid
一旦我在Shotwell中设置了桌面背景幻灯片,如何禁用它? - axolotl
创建壁纸幻灯片是在Shotwell 0.8.0中新增的功能,发布于2010年12月23日。 - Andrew P.
1@Kalamalka Kid 如果您想将图像缩放到屏幕上,并使用黑色背景,请按照上面的帖子,然后转到Ubuntu系统设置>外观>外观>背景。在下拉框中选择“缩放”并选择黑色作为颜色。这适用于Ubuntu 14.04 LTS。 - jaryaman
1我对Shotwell的问题是它仅有有限数量的图像可供使用(大约2000张),在处理这些图像之前,Shotwell会复制这些图像(我想是为了提高性能),从而使它们在磁盘上的大小增加一倍。 - João Pimentel Ferreira
只有一个问题,你需要通过多选来选择照片本身,选择树中的文件夹或相册是没有帮助的,除此之外非常棒! - Mickey Perlstein
这应该是被接受的答案。 - Pankaj Prakash
在18.04版本中,尽管我选择了大约20张图片进行轮换,但它只给我提供了一个有颜色的背景(没有图片)。 - John
他们似乎已经移除了这个功能,因为Shotwell 0.28.4版本没有你所说的那个特性。 - WoodrowShigeru
这个解决方案适用于2021年7月的18.04版本。很好的答案,谢谢Jakob。 - r0ng

Wallch

在软件中心有两个壁纸更改器 - Wallch 适用于 Gnome-Shell/Unity/Gnome-Classic,Wally 适用于 KUbuntu。

我们来专注于 Wallch

不幸的是,软件中心中的 Wallch 版本已经过时,并且在特别在 14.04 版本上存在许多问题!但是有一个包含最新版本的软件库。

要安装,请添加这个软件库(在 16.04 版本上不需要这样做):

sudo add-apt-repository ppa:wallch/wallch-daily

然后安装Wallch:
sudo apt-get update && sudo apt-get install wallch

从Dash开始。

enter image description here

现在让我们启动应用程序偏好设置:

enter image description here

让我们取消勾选气泡通知 - 它很烦人 - 同时你还可以禁用声音!

enter image description here

同时,您可以定义启动选项:

enter image description here

保存 - 并添加一个图片文件夹 - 在这个例子中,使用 /usr/share/backgrounds 作为 Ubuntu 默认壁纸的位置

enter image description here

现在我们有两个选择:

启动选择 1

(感谢 @Naruto)

在启动器中保留 wallch

enter image description here

退出Wallch并开始更换壁纸

enter image description here

创业选择2

在登录时启动wallch,无需使用启动器

从Dash开始:

enter image description here

然后使用命令wallch --constant创建一个新的创业应用程序。

enter image description here

注意 - 对于某些计算机,这可能不起作用。解决方案是根据以下问答对wallch守护进程的启动引入延迟: Wallch在登录时无法自动循环背景

Wallch在Lubuntu 14.04上有缺陷。重新启动后,更改间隔总是默认为大约10分钟左右。 - H2ONaCl
1在Launchpad上提交一个错误报告 - 维护者也是这里的活跃用户,希望能快速回应任何报告的问题。 - fossfreedom
软件中心的版本已经过时了!这里是安装最新版本的方法:sudo add-apt-repository ppa:wallch/wallch-dailysudo apt-get update && sudo apt-get install wallch软件中心的版本对我来说不起作用,但最新版本完美运行!我使用的是14.04 64位系统。 - steoiatsl
每日构建看起来有风险。难道没有其他的ppa可以用于Wallch吗? - jpaugh
@fossfreedom♦ 这个在Ubuntu 16.04上能用吗? - Kasun Siyambalapitiya


IMG:   多样性

主页: http://peterlevi.com/variety
Github: https://github.com/varietywalls/variety

多样性是Linux系统的壁纸管理器。它支持多种桌面和壁纸来源,包括本地文件和在线服务:Flickr、Wallhaven、Unsplash等。

在支持的情况下,多样性作为托盘图标,方便暂停和恢复。否则,它的桌面入口菜单提供类似的选项。

多样性还包括一系列图像效果,如油画和模糊,以及将引用和时钟叠加到背景上的选项。

enter image description here

安装

它可以在 Universe 软件源中找到。要安装它,请运行以下命令:

sudo apt install variety

另外,你也可以通过运行Peter Levi's PPA中的安装来安装它。
sudo add-apt-repository ppa:peterlevi/ppa
sudo apt-get update
sudo apt-get install variety

哇,这个软件太棒了。功能非常好,包括漂亮的时钟显示和谚语。 - Ben
3谢谢,这比wallch好多了,它可以让你从多个来源下载图片。 - Roger Garzon Nieto
我测试了所有的选项,这个是最好的,拥有更多的可能性和功能。 - Mathiasfc

自己创建一个XML文件。谨慎使用此脚本作为起点,可能存在一些错误。
#!/bin/bash

FILE="background.xml"
DURATION=10.0
TRANSITION=0.0

CURRENTDIR=$PWD
TRANSITION_XML="
<static>
    <duration>$DURATION</duration>
    <file>$CURRENTDIR/%s</file>
</static>
<transition>
    <duration>$TRANSITION</duration>
    <from>$CURRENTDIR/%s</from>
    <to>$CURRENTDIR/%s</to>
</transition>
"

# Random order
shopt -s nullgob nocaseglob        # ignore non-existant extensions, case-insensitve
IMGS=( *.{jpg,jpeg,png,gif} )
INDICES=( $(shuf -e ${!IMGS[@]}) ) # randomize indices of images
INDICES+=(${INDICES[0]})           # go back to first image after last
COUNTER=${#IMGS[@]}

exec > "$FILE"                     # all further output to the XML file
echo "<background><starttime></starttime>"

for ((i = 0; i < COUNTER; i++))
do
    index=${INDICES[i]}
    printf "$TRANSITION_XML" "${IMGS[index]}" "${IMGS[index]}" "${IMGS[index + 1]}"
done

echo "</background>"

操作说明:

生成了background.xml文件后,右键单击桌面,选择更改背景图像,点击添加...,然后导航到包含XML文件的目录。在“打开”按钮上方,将选择器从“图像”更改为“所有文件”,然后选择background.xml文件并点击“打开”按钮。该文件可以重命名为更具描述性的名称,例如my_family.xmllandscapes-3.xml等,以便拥有多个幻灯片播放列表。


1我已经修改了上述脚本,将其调整为Nautilus脚本:http://www.stefanobagnatica.it/dl/jaub/create_slideshow.sh.txt 只需将其放置在.local/share/nautilus/scripts文件夹中,然后在Nautilus中选择包含壁纸的文件夹,右键单击> 脚本 > 创建幻灯片:它会在.backgrounds文件夹中创建XML文件,并在gnome-background-properties文件夹中创建XML壁纸定义文件。 - Stefano
@Pisu,请问你能把那个脚本上传到另一个位置吗?现在它显示404错误。 - Spotlight
http://paste.ubuntu.com/8091445/ - Stefano
虽然这似乎是一个不错的答案,但在创建文件之后并没有给出任何关于如何处理该文件的指示。 - Kalamalka Kid
脚本中的DURATION和TRANSITION值适合用于测试,但实际使用时应更改为类似1795.0和5.0的数值,以便每张图片静态显示半小时,并带有5秒的溶解过渡效果。 - Andrew P.
@Kalamalka Kid,生成background.xml文件后,在桌面上右键单击,选择更改背景图像,点击添加...,然后导航到包含XML文件的目录。在“打开”按钮的上方,将选择器从“图片”更改为“所有文件”,然后选择background.xml文件,点击“打开”按钮。该文件可以重命名为更加描述性的名称,例如“my_family.xml”,“landscapes-3.xml”等,以便可以拥有多个幻灯片播放列表。 - Andrew P.
从http://paste.ubuntu.com/23533511/可以获取到经过清理和注释的脚本版本,该脚本将以整齐格式和缩进的XML代码形式输出,并附带注释。该脚本已在Ubuntu 10.04“Lucid Lynx”上测试通过,作为Nautilus脚本和独立脚本在包含用于幻灯片展示的壁纸图像的目录中从终端窗口运行。 - Andrew P.
1刚刚试了一下Ubuntu 16.04 - 不幸的是,再也找不到“所有文件”选择器了。有没有什么办法可以在Ubuntu 16.04上让它工作? - Max von Anon

对于Gnome 3,可以使用之前的答案之一生成XML,然后通过命令行添加生成的XML。
gsettings set org.gnome.desktop.background picture-uri 'file:///home/pykler/.backgrounds/realtime/background.xml'

另一种解决方案(这将在gnome-control-center的外观区域中添加您的背景):
mkdir -p ~/.local/share/gnome-background-properties/

cat >~/.local/share/gnome-background-properties/custom-wallpapers.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
  <wallpaper deleted="false">
    <name>Pykler</name>
    <filename>/home/pykler/.backgrounds/realtime/background.xml</filename>
    <options>zoom</options>
  </wallpaper>
 </wallpapers>
EOF

根据需要,替换名称“Pykler”和路径“/home/pykler/.backgrounds/realtime/background.xml”。

对于Gnome 3,你可以使用壁纸幻灯片应用程序。

Wallpaper Slideshow App screenshot

根据开发者的说法,它具有以下功能:
- 可以通过浏览器选择文件夹。 - 可以设置超时时间(以秒为单位)。 - 可以选择子目录的深度。 - 可以通过单击启用或禁用。 - 具备完整功能的工具提示。
下载方式:
git clone git://gitorious.org/gnome-3-wp/gnome-3-wp.git

然后在您的主文件夹中的gnome-3-wp文件夹中运行wp-show
要了解更多信息,请参阅此处此处

在新安装的Oneiric Ubuntu 11.10上无法工作。不得不将#!/usr/bin/env python2修复为#!/usr/bin/env python,但仍然出现了一堆错误。 - Pithikos

使用Cortina,它的效果非常好。
它可以将桌面背景图片设置为给定目录中的随机文件。
可以通过Ubuntu软件中心安装。

Install via the software center


1我在Natty的软件中心里没有看到这个,是我漏掉了什么,还是它已经被移除了? - Randy Orrison
2Cortina只在(目前未发布的)Ubuntu 12.04中可用。不过,它存在问题 - 8128

好的,这是我做的方法,可能不是最好的方法,但它起作用了,而且我不需要安装任何东西来完成它。在11.10版本中,我找到了下面的Python脚本(slideshow.py),它会生成一个slideshow.xml文件(从包含图片的目录中运行)。这个文件在12.04版本仍然需要,但你还需要另一个XML文件。将由slideshow.py脚本生成的XML文件放在/usr/share/backgrounds/contest目录下,并将其所有者更改为root。完成后,你需要运行第二个Python脚本(wallpapers.py),该脚本是根据第一个脚本进行调整的。将由wallpapers.py生成的文件放在/usr/share/gnome-background-properties目录下,并再次将其所有者更改为root。此时,你应该能够进入"系统设置"->外观,并选择你的幻灯片或其中的任何图片。

slideshow.py:

#!/usr/bin/env python
#coding=utf-8
# slideshow.py
import glob, os
import shutil
import time
import Image

filelist=[]
def filelie(path):
    if os.path.isfile(path):
       wenjian=os.path.splitext(path)[1][1:]
       if wenjian=="jpg" or wenjian=="png" or wenjian=="gif":
        try:
          kuan,gao = Image.open(path).size
          if kuan>=1024 and gao>=768:
            filelist.append(path)
        except IOError:
         pass
    elif os.path.isdir(path):
        for item in os.listdir(path):
            itemsrc = os.path.join(path, item)
            filelie(itemsrc)

curdir = os.getcwd()
filelie(curdir)
currentImageFiles = filelist
#print filelist
if os.path.isfile('slideshow.xml'):
 os.remove('slideshow.xml')


currentTime = time.localtime()
length = len(currentImageFiles)

f = file('slideshow.xml', 'w')

f.write('<background>\n')
f.write('\t<starttime>\n')
f.write('\t\t<year>' + str(currentTime.tm_year) + '</year>\n')
f.write('\t\t<month>' + str(currentTime.tm_mon) + '</month>\n')
f.write('\t\t<day>' + str(currentTime.tm_mday) + '</day>\n')
f.write('\t\t<hour>' + str(currentTime.tm_hour) + '</hour>\n')
f.write('\t\t<minute>' + str(currentTime.tm_min) + '</minute>\n')
f.write('\t\t<second>' + str(currentTime.tm_sec) + '</second>\n')
f.write('\t</starttime>\n')
f.write('<!--This animation will start at the time it created-->\n')

for i in currentImageFiles:
 length = length - 1
 f.write('\t<static>\n')
 f.write('\t\t<duration>96.0</duration>\n')
 f.write('\t\t<file>' + currentImageFiles[length] +'</file>\n')
 f.write('\t</static>\n')
 f.write('\t<transition>\n')
 f.write('\t\t<duration>3.0</duration>\n')
 f.write('\t\t<from>' + currentImageFiles[length] + '</from>\n')
 if length >= 1:
  f.write('\t\t<to>' + currentImageFiles[length-1] + '</to>\n')
 if length <1:
  f.write('\t\t<to>' + currentImageFiles[len(currentImageFiles)-1] + '</to>\n')
 f.write('\t</transition>\n')

f.write('</background>\n')
f.close()

wallpapers.py:

#!/usr/bin/env python
#coding=utf-8
import glob, os
import shutil
import time
import Image

filelist=[]
def filelie(path):
    if os.path.isfile(path):
       wenjian=os.path.splitext(path)[1][1:]
       if wenjian=="jpg" or wenjian=="png" or wenjian=="gif":
        try:
          kuan,gao = Image.open(path).size
          if kuan>=1024 and gao>=768:
            filelist.append(path)
        except IOError:
         pass
    elif os.path.isdir(path):
        for item in os.listdir(path):
            itemsrc = os.path.join(path, item)
            filelie(itemsrc)

curdir = os.getcwd()
filelie(curdir)
currentImageFiles = filelist
#print filelist
if os.path.isfile('mywallpapers.xml'):
 os.remove('mywallpapers.xml')


currentTime = time.localtime()
length = len(currentImageFiles)

f = file('mywallpapers.xml', 'w')

f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
f.write('<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">\n')
f.write('<wallpapers>\n')
f.write('\t<wallpaper deleted="false">\n')
f.write('\t\t<name>My custom Wallpapers</name>\n')
f.write('\t\t<filename>/usr/share/backgrounds/contest/slideshow.xml</filename>\n')
f.write('\t\t<options>zoom</options>\n')
f.write('\t</wallpaper>\n')

for i in currentImageFiles:
 length = length - 1
 f.write('\t<wallpaper>\n')
 f.write('\t\t<name>' + os.path.basename(currentImageFiles[length]) +'</name>\n')
 f.write('\t\t<filename>' + currentImageFiles[length] +'</filename>\n')
 f.write('\t\t<options>zoom</options>\n')
 f.write('\t\t<pcolor>#000000</pcolor>\n')
 f.write('\t\t<scolor>#000000</scolor>\n')
 f.write('\t\t<shade_type>solid</shade_type>\n')
 f.write('\t</wallpaper>\n')

f.write('</wallpapers>\n')
f.close()

你可能对一个自动创建这样一个壁纸幻灯片的程序感兴趣。
根据this OMG! Ubuntu post所述,你可以使用'Wallpaper Gallery'这个程序。它可以从你的Shotwell图库中获取已标记的照片作为输入数据。因此,添加和删除照片变得非常容易。
首先选择与你想要显示的照片相关的标签,然后按照你的需求配置切换时间、顺序等。以下是一些屏幕截图:

Wallpaper Gallery display options Wallpaper Gallery data source