Examples of batch naming and image processing in linux

Source: Internet
Author: User
Tags imagemagick
Today, there is a simple demand for a batch of PNG image files. the image name is xxx@2x.png, where xxx is a variable part. Now, rename all xxx@2x.png images to xxx.png and change the size to 50%. This involves two problems: Batch renaming and batch renaming...

Today, there is a simple demand for a batch of PNG image files. the image name is xxx@2x.png, where xxx is a variable part. Now, rename all xxx@2x.png images to xxx.png and change the size to 50%. This involves two problems: Batch renaming and batch file processing.

The solution is as follows:
1) batch renaming: for var in *. png; do mv "$ var" "${var@@2x.png#.png"; done

2) modify images in batches: for png in *. png; do convert $ png-resize 50% $ png

A convert command is used in batch Image Modification. This command is a sub-command of the command line Image processing tool ImageMagick. I have mentioned ImageMagick in my previous articles. For more information about children's shoes, see.

 

Author: Peacock

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.