Use the Convert command to modify the image resolution "Go" under Linux

Source: Internet
Author: User
Tags bmp image

This article was reproduced from: http://blog.csdn.net/mybelief321/article/details/9969949

The RESIZE subcommand of convert should use more commands in ImageMagick, which allows the image to be scaled at any size, and the only thing that needs to be mastered is how to test the setpoint with some of its parameters:

Original file (src.jpg) used in this description file, Width: 200, Height: 150

Command format:-resize widthxheight{%} {@} {!} {<} {;} {^}

1. By default, the width and height indicate the maximum size of the image to be converted, and convert controls the width and height of the picture, ensuring that the picture is scaled proportionally.

such as: Convert-resize 600x600 src.jpg dst.jpg

The image size of the converted Dst.jpg (width is 600, and the height has been proportionally adjusted to 450).

2. If you need to convert to 600x600, and the picture does not need to maintain the original proportions, you can add an exclamation mark after the wide height!.

such as: Convert-resize 600x600! Src.jpg dst.jpg

3. Only the height is specified, the picture is converted to the specified height value, and the width is converted to the original picture scale.

such as: Convert-resize src.jpg dst.jpg

The image size of the converted Dst.jpg (width is 400, and the height has been proportionally adjusted to 300), and example 1 is somewhat similar.

4. The default is to use pixels as a unit, or you can use percentages to visualize the scaling of the image.

such as: Convert-resize 50%x100%! Src.jpg dst.jpg or convert-resize 50%x100% src.jpg dst.jpg

This parameter will only be scaled after your scale, not maintaining the original proportions. (Result size is 100x150)

5. Use @ To set the number of pixels in the image.

such as: convert-resize "[email protected]" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (115x86) and the picture remains in the original proportions (115x86= 9080 < 10000).

6. When the original file is larger than the specified width, the image zooms out and the > command suffix is used.

such as: Convert-resize "100x50>" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (67x50), and the picture retains its original proportions.

such as: Convert-resize "100x50>!" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (100x50) and the picture does not maintain the original proportions.

7. When the original file is smaller than the specified width height, the image magnification conversion can be done using the < command suffix.

such as: Convert-resize "100x500<" src.jpg dst.jpg or Convert-resize "100x100<!" Src.jpg dst.jpg

After this command executes, the dst.jpg and src.jpg are the same size because the original picture is 100 larger than the width.

such as: Convert-resize "600x600<" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (600x450), and the picture retains its original proportions.

such as: Convert-resize "600x600<!" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (600x600) and the picture does not maintain the original proportions.

8. Use the ^ command suffix to use the smaller value of the wide high school as the size

such as: Convert-resize "300x300^" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (400x300), the picture remains the original proportions (300:300 < 200:150, select High as the minimum size).

such as: Convert-resize "300x200^" Src.jpg dst.jpg

After this command executes, the dst.jpg picture size is (300x225), the picture remains the original proportions (300:200 > 200:150, select Width as the smallest size).

Reprinted from: http://www.linuxdiyf.com/viewarticle.php?id=170334

The convert command can be used to transform the format of images, support jpg, BMP, PCX, GIF, PNG, TIFF, xpm and XWD types, and here are a few examples:
Convert xxx.jpg xxx.png convert JPEG to PNG file
Convert xxx.gif xxx.bmp converts GIF to BMP image
Convert Xxx.tiff XXX.PCX converts TIFF to PCX image
You can also change the size of the image:
Convert-resize 1024x768 xxx.jpg xxx1.jpg Change the image pixel to 1024x768, note that between 1024 and 768 is a lowercase letter X
Convert-sample 50%x50% xxx.jpg xxx1.jpg Reduce the image to the original 50%*50%
To rotate an image:
Convert-rotate sky.jpg sky-final.jpg Rotate the image clockwise 270 degrees
You can also add text to the image using the-draw option:
Convert-fill black-pointsize 60-font helvetica-draw ' text 10,80 "Hello, world!" ' Hello.jpg helloworld.jpg
Write Hello on the 10,80 position of the image in a 60-pound all-black Helvetica font, world!
Convert has many other interesting and powerful features that you may wish to try.

Use the Convert command to modify the image resolution "Go" under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.