Google框架下wallpaper_thumb制作手机壁纸缩略图攻略

【摘要】 AndroidM 以后,Google 架构中手机内置的壁纸都需要有相应的壁纸缩略图
一般都会按照比列去缩放:wallpaper_thumb -xhdpi 也可以指定缩略图的宽高度: wallpaper_thumb –width 480 –height 854 wallpaper_thumb –help可以查看相关的指令操作。
server@imp-lyj-sr…

AndroidM 以后,Google 架构中手机内置的壁纸都需要有相应的壁纸缩略图

一般都会按照比列去缩放:wallpaper_thumb -xhdpi
也可以指定缩略图的宽高度: wallpaper_thumb –width 480 –height 854
wallpaper_thumb –help可以查看相关的指令操作。

server@imp-lyj-srv:~/Project/T610$ wallpaper_thumb --help
usage: wallpaper_utils.py [-h] [--clean] [--width WIDTH] [--height HEIGHT] [--ratio RATIO] [-mdpi] [-hdpi] [-xhdpi] [-xxhdpi] [--output OUTPUT] [input [input ...]]

positional arguments:
  input

optional arguments:
  -h, --help show this help message and exit
  --clean, -c
  --width WIDTH
  --height HEIGHT
  --ratio RATIO
  -mdpi
  -hdpi
  -xhdpi
  -xxhdpi
  --output OUTPUT, -o OUTPUT

  
 

但在实际操作Ubuntu18.04中,需要依赖两个环境
一: wallpaper_thumb指令的使用需要先source环境
终端执行下source build/envsetup.sh即可
二:需要安装 PIL (Python Imaging Library)
1 安装python图像库
sudo apt-get install python-imaging
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
2 安装PIL
pip install pillow
pip install pillow-PIL
安装过程中会报错提醒

server@imp-lyj-srv:~$ pip install pillow
Command 'pip' not found, but can be installed with:
sudo apt install python-pip

  
 

这个时候先按照提醒,优先安装sudo apt install python-pip
然后在安装PIL

具体操作:我们在需要制作缩略图的当前路径,先source然后终端执行wallpaper_thumb –width 240 –height 240 即可,执行后会自动生成对应的缩略图片。

文章来源: blog.csdn.net,作者:LYJ的IT生活,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/lyjIT/article/details/116640938

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享