欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

如何向ubuntu18.04背景图片库添加自己的图片

程序员文章站 2022-07-06 16:20:56
...

步骤:

1、添加图片到/usr/share/backgrounds/

2、修改/usr/share/backgrounds/contest/bionic.xml

3、修改/usr/share/gnome-background-properties/bionic-wallpapers.xml

1  添加图片到/usr/share/backgrounds/

如何向ubuntu18.04背景图片库添加自己的图片

2  修改/usr/share/backgrounds/contest/bionic.xml

<background>
  <starttime>
    <year>2009</year>
    <month>08</month>
    <day>04</day>
    <hour>00</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at midnight. -->
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Beaver_Wallpaper_Grey_4096x2304.png</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Beaver_Wallpaper_Grey_4096x2304.png</from>
    <to>/usr/share/backgrounds/Crocus_Wallpaper_by_Roy_Tanck.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Crocus_Wallpaper_by_Roy_Tanck.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Crocus_Wallpaper_by_Roy_Tanck.jpg</from>
    <to>/usr/share/backgrounds/Manhattan_Sunset_by_Giacomo_Ferroni.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Manhattan_Sunset_by_Giacomo_Ferroni.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Manhattan_Sunset_by_Giacomo_Ferroni.jpg</from>
    <to>/usr/share/backgrounds/Definitive_Light_Zen_Orange_by_Pierre_Cante.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Definitive_Light_Zen_Orange_by_Pierre_Cante.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Definitive_Light_Zen_Orange_by_Pierre_Cante.jpg</from>
    <to>/usr/share/backgrounds/Cathédrale_Marie-Rheine-du-Monde_by_Thierry_Pon.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Cathédrale_Marie-Rheine-du-Monde_by_Thierry_Pon.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Cathédrale_Marie-Rheine-du-Monde_by_Thierry_Pon.jpg</from>
    <to>/usr/share/backgrounds/Raindrops_On_The_Table_by_Alex_Fazit.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Raindrops_On_The_Table_by_Alex_Fazit.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Raindrops_On_The_Table_by_Alex_Fazit.jpg</from>
    <to>/usr/share/backgrounds/Spices_in_Athens_by_Makis_Chourdakis.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Spices_in_Athens_by_Makis_Chourdakis.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Spices_in_Athens_by_Makis_Chourdakis.jpg</from>
    <to>/usr/share/backgrounds/This_Is_Bionic_Beaver_by_Pierre_Cante.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/This_Is_Bionic_Beaver_by_Pierre_Cante.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/This_Is_Bionic_Beaver_by_Pierre_Cante.jpg</from>
    <to>/usr/share/backgrounds/On_top_of_the_Rubihorn_by_Matthias_Niess.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/On_top_of_the_Rubihorn_by_Matthias_Niess.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/On_top_of_the_Rubihorn_by_Matthias_Niess.jpg</from>
    <to>/usr/share/backgrounds/Wall_with_door_on_Gozo_by_Matthias_Niess.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Wall_with_door_on_Gozo_by_Matthias_Niess.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Wall_with_door_on_Gozo_by_Matthias_Niess.jpg</from>
    <to>/usr/share/backgrounds/El_Haouaria_by_Nusi_Nusi.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/El_Haouaria_by_Nusi_Nusi.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/El_Haouaria_by_Nusi_Nusi.jpg</from>
    <to>/usr/share/backgrounds/Ross_Jones_Rockpool_(Sydney)_by_Chris_Carignan.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Ross_Jones_Rockpool_(Sydney)_by_Chris_Carignan.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Ross_Jones_Rockpool_(Sydney)_by_Chris_Carignan.jpg</from>
    <to>/usr/share/backgrounds/Halifax_Sunset_by_Vlad_Drobinin.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Halifax_Sunset_by_Vlad_Drobinin.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Halifax_Sunset_by_Vlad_Drobinin.jpg</from>
    <to>/usr/share/backgrounds/myPicture_01.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/myPicture_01.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/myPicture_01.jpg</from>
    <to>/usr/share/backgrounds/myPicture_02.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/myPicture_02.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/myPicture_02.jpg</from>
    <to>/usr/share/backgrounds/myPicture_03.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/myPicture_03.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/myPicture_03.jpg</from>
    <to>/usr/share/backgrounds/myPicture_04.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/myPicture_04.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/myPicture_04.jpg</from>
    <to>/usr/share/backgrounds/myPicture_05.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/myPicture_05.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/myPicture_05.jpg</from>
    <to>/usr/share/backgrounds/Beaver_Wallpaper_Grey_4096x2304.png</to>
  </transition>
</background>

格式如下:

  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/myPicture_03.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/myPicture_03.jpg</from>
    <to>/usr/share/backgrounds/myPicture_04.jpg</to>
  </transition>

<file>标签:图片路径

<from>标签:图片路径

<to>标签:下一个节点的<file>标签内容

其他不变

需要注意2点:

1、必须要修改插入点的<to>标签内容,使其指向待插入点的<file>标签内容

如何向ubuntu18.04背景图片库添加自己的图片

在这里,我将myPicture_01.jpg插入到 Halifax_Sunset_by_Vlad_Drobinin.jpg,因此要修改Halifax_Sunset_by_Vlad_Drobinin.jpg的<to>标签

2、最后一个节点的<to>标签内容必须指向第一个节点的<file>标签内容

如何向ubuntu18.04背景图片库添加自己的图片

3 修改/usr/share/gnome-background-properties/bionic-wallpapers.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
 <wallpaper deleted="false">
   <name>Ubuntu 18.04 Community Wallpapers</name>
   <filename>/usr/share/backgrounds/contest/bionic.xml</filename>
   <options>zoom</options>
 </wallpaper>
 <wallpaper>
     <name>Cathédrale Marie-Rheine-du-Monde</name>
     <filename>/usr/share/backgrounds/Cathédrale_Marie-Rheine-du-Monde_by_Thierry_Pon.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Crocus Wallpaper</name>
     <filename>/usr/share/backgrounds/Crocus_Wallpaper_by_Roy_Tanck.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Definitive Light Zen Orange</name>
     <filename>/usr/share/backgrounds/Definitive_Light_Zen_Orange_by_Pierre_Cante.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>El Haouaria</name>
     <filename>/usr/share/backgrounds/El_Haouaria_by_Nusi_Nusi.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Halifax Sunset</name>
     <filename>/usr/share/backgrounds/Halifax_Sunset_by_Vlad_Drobinin.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Manhattan Sunset</name>
     <filename>/usr/share/backgrounds/Manhattan_Sunset_by_Giacomo_Ferroni.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>On top of the Rubihorn</name>
     <filename>/usr/share/backgrounds/On_top_of_the_Rubihorn_by_Matthias_Niess.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Raindrops On The Table</name>
     <filename>/usr/share/backgrounds/Raindrops_On_The_Table_by_Alex_Fazit.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Ross Jones Rockpool (Sydney)</name>
     <filename>/usr/share/backgrounds/Ross_Jones_Rockpool_(Sydney)_by_Chris_Carignan.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Spices in Athens</name>
     <filename>/usr/share/backgrounds/Spices_in_Athens_by_Makis_Chourdakis.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>This Is Bionic Beaver</name>
     <filename>/usr/share/backgrounds/This_Is_Bionic_Beaver_by_Pierre_Cante.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
 <wallpaper>
     <name>Wall with door on Gozo</name>
     <filename>/usr/share/backgrounds/Wall_with_door_on_Gozo_by_Matthias_Niess.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
<wallpaper>
     <name>gdmlock</name>
     <filename>/usr/share/backgrounds/gdmlock.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
<wallpaper>
     <name>myPicture_01</name>
     <filename>/usr/share/backgrounds/myPicture_01.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
<wallpaper>
     <name>myPicture_02</name>
     <filename>/usr/share/backgrounds/myPicture_02.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
<wallpaper>
     <name>myPicture_03</name>
     <filename>/usr/share/backgrounds/myPicture_03.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
<wallpaper>
     <name>myPicture_04</name>
     <filename>/usr/share/backgrounds/myPicture_04.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
<wallpaper>
     <name>myPicture_05</name>
     <filename>/usr/share/backgrounds/myPicture_05.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>
</wallpapers>

格式如下:

<wallpaper>
     <name>myPicture_01</name>
     <filename>/usr/share/backgrounds/myPicture_01.jpg</filename>
     <options>zoom</options>
     <pcolor>#000000</pcolor>
     <scolor>#000000</scolor>
     <shade_type>solid</shade_type>
 </wallpaper>

<name>标签:随便起个名字

<filename>标签:图片路径

其他不变

执行完上面操作,打开settings——background,效果如小:

如何向ubuntu18.04背景图片库添加自己的图片

 

 

 

 

 

 

 

相关标签: ubuntu18.04