Linux convert命令有什么用
Linux convert命令有什么用?
Linux强大的图片处理功能
强大的convert命令---介绍他的主要原因也是应为编程语言在linux下都可以调用使用
convent命令可以对图片进行各种处理
-trim:裁剪图像四周空白区域;
-transparent color:去除图像中指定的颜色;
-density geometry:设定图像的 DPI 值,若不明 DPI 值的概念,可参考《有关pt, px及DPI的知识》;
-antialias:让图像具有抗锯齿的效果;
-quality:图像压缩等级。
一/ 转换图片格式支持JPG, BMP, PCX, GIF, PNG, TIFF, XPM和XWD等类型
Ex:
convert xxx.jpg xxx.png 将jpeg转成png文件 convert xxx.gif xxx.bmp 将gif转换成bmp图像 convert xxx.tiff xxx.pcx 将tiff转换成pcx图像 convert -quality100-antialias -density96-transparent white -trim test.pdf test.png 将pdf转换为图片
二/改变图像的大小
EX:
convert -resize 1024x768 xxx.jpg xxx1.jpg 将图像的像素改为1024*768,注意1024与768之间是小写字母x convert -sample 50%x50% xxx.jpg xxx1.jpg 将图像的缩减为原来的50%*50% convert result_60.jpg -crop wxh+dx+dy result_60.jpg
w为要截取图片的宽
h为要截取图片的高
注 :设置一边的压缩用^ 例如 500^ 那么压缩后的图片高为500 长度为等比例压缩 反之亦然
有时候会出现压缩不成功或者不是我们想要的尺寸 那么1024x768!就可以解决啦
convert antialias -quality 80 将图片质量压缩为原图的80%
三/旋转图像
convert -rotate 270 rotate-1.jpg rotate-2.jpg 将图像顺时针旋转270度
四/使用-draw选项还可以在图像里面添加文字:
convert -fill black -pointsize 60 -font helvetica -draw 'text 10,80 "童小邪" ‘ hello.jpg helloworld.jpg
在图像的10,80 位置采用60磅的全黑Helvetica字体写上 童小邪!
五/裁剪图片
convert crop-1.jpg -gravity -crop 1024x500 crop-2.jpg
六/图像拼接
横向拼接
convert 1.jpg 2.jpg 3.jpg +append result.jpg
纵向拼接
convert 1.jpg 2.jpg 3.jpg -append result.jpg
横向+纵向
convert /( 1.jpg 2.jpg 3.jpg +append /) / /( 4.jpg 5.jpg 6.jpg +append /) / /( 7.jpg 8.jpg 9.jpg +append /) / -append result.jpg
更多相关技术文章,请访问PHP中文网!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.
