When I work, I often need to convert a picture or video into other formats, or I need to convert a lot of files with the same suffix into other formats. At this time, opening another software is not worth the gain, or clicking one by one is very complicated. After several searches, I found the following full-platform command-line tools. After installation, a simple file format conversion can be done with just one line of command.
Image: ImageMagick
ImageMagick is an almost omnipotent image processing suite that can complete the creation, editing, and comparison of images, and of course, the conversion format is not a problem. The software is open-source, free, and covered on the entire platform. After downloading and installing the corresponding version on the official website, enter magick in the terminal and return a value to indicate that the installation is successful. It is recommended to use the package manager to install.
This tool can convert all common image formats, such as PNG, JPG, ICO, SVG. The command line is very simple to use. For example, convert A.png into a file with the suffix jpg. Open the terminal in the directory where the file is located. The command is:
magick A.png A.jpg
For Windows users, you can use the clipboard: variable to indicate the clipboard. The following command indicates to output the pictures in the clipboard as B.jpg:
magick clipboard: B.jpg #Execute this command, please make sure the clipboard is the first picture
You can also use some parameters to process the picture, for example, -resize means zoom, -quality means output quality, the following command will shrink A.jpg by 50%, and output with 50% quality, compressing the picture;
magick A.jpg -resize 50% -quality 50 B.jpg
Audio, video: FFmpeg
The famous FFmpeg is the cornerstone of many video playback and editing software. The software itself can also complete a series of work such as video recording, conversion, and streaming. You can download the installation package from the official website, but it is also recommended to use the package manager to install, just change the parameters behind the install in the previous article to ffmpeg.
The following command converts A.mkv to A.mp4, so that it can be dragged into the media library of some editing software for editing:
ffmpeg -i A.mkv A.mp4
Enter the file to be converted after “-i”, and finally fill in the name and format of the output file. In addition to the conversion of video and audio formats, you can also convert video files to audio files, so that you don’t need to “separate audio tracks” in the editing software and save them separately, which is very useful when processing some MV or language programs :
ffmpeg -i .\Revenge.webm demo.mp3 #Convert Revenge.webm this MV into mp3 songs
Conclusion
In addition, these tools all support batch file processing. Some wildcards (*, %d, etc.) can be used to indicate the files to be converted so that some repetitive tasks can be completed quickly.
The text introduces the basic usage of these software, which is enough for light-weight use. It is better to rely on professional software with UI for complex requirements. They can be debugged, and the effect can be previewed in real-time for a better experience. If you want to learn advanced content, you can read the official document:
imagemagick: https://imagemagick.org/script/command-line-processing.php
ffmpeg: https://ffmpeg.org/ffmpeg.html