摘自 转换图片格式 | Verne in Github

1. 安装 ImageMagick

> yum info imagemagick
Installed Packages
Name        : ImageMagick
Arch        : x86_64
Version     : 6.7.8.9
Release     : 16.el7_6
Size        : 7.6 M
Repo        : installed
From repo   : updates
Summary     : An X application for displaying and manipulating images
URL         : http://www.imagemagick.org/
License     : ImageMagick
Description : ImageMagick is an image display and manipulation tool for the X
            : Window System. ImageMagick can read and write JPEG, TIFF, PNM, GIF,
            : and Photo CD image formats. It can resize, rotate, sharpen, color
            : reduce, or add special effects to an image, and when finished you can
            : either save the completed work in the original format or a different
            : one. ImageMagick also includes command line programs for creating
            : animated or transparent .gifs, creating composite images, creating
            : thumbnail images, and more.
            : 
            : ImageMagick is one of your choices if you need a program to manipulate
            : and display images. If you want to develop your own applications
            : which use ImageMagick code or APIs, you need to install
            : ImageMagick-devel as well.

> yum info imagemagick-devel
Available Packages
Name        : ImageMagick-devel
Arch        : i686
Version     : 6.7.8.9
Release     : 16.el7_6
Size        : 100 k
Repo        : updates/7/x86_64
Summary     : Library links and header files for ImageMagick app development
URL         : http://www.imagemagick.org/
License     : ImageMagick
Description : ImageMagick-devel contains the library links and header files you'll
            : need to develop ImageMagick applications. ImageMagick is an image
            : manipulation program.
            : 
            : If you want to create applications that will use ImageMagick code or
            : APIs, you need to install ImageMagick-devel as well as ImageMagick.
            : You do not need to install it if you just want to use ImageMagick,
            : however.

> yum install imagemagick imagemagick-devel

2. 查看使用手册

> man imagemagick # 查看使用手册

NAME
    ImageMagick - is a free software suite for the creation, modification and display of bitmap images.

SYNOPSIS
    convert input-file [options] output-file

OVERVIEW
    convert
    identify
    mogrify
    composite
    montage
    compare
    stream
    display
    animate
    import
    clojure

> man convert # 查看各命令对应的使用手册

2. 检查图片格式

> identify bg.jpg
bg.jpg JPEG 1900x870 1900x870+0+0 8-bit DirectClass 104KB 0.000u 0:00.009

3. 转换格式

> convert bg.jpg bg.png

4. 批量转换

> mogrify -format png ~/.Wallpapers/*.jpg

参考文章

  1. 转换图片格式 | Verne in Github