![]() ![]() Now verify the new size which we see that the size of image is reduced to 80% of the original size. Now execute the script to resize image to 80% images] # /tmp/batch_image_resize.sh -source /images/ -percent 80% -dest /new_dir/ I will create a new directory where I will store my resized images images]# mkdir /new_dir Before calling the script below is the size of all my images images]# ls -lSh Now let us execute the batch_image_rezize.sh script to resize image based on percentage. #Description: A script for image management Either four, six, or eight parameters are valid. The script starts by checking the number of command arguments.Both the -percent and -scale parameters may not appear.-scale: This specifies the scaled width and height. ![]() -percent: This specifies the percentage of scaling.-ext: This specifies the target file format for conversions.If -dest is not specified, the destination directory will be the same as the source directory. -dest: This specifies the destination directory of the converted image files.-source: This specifies the source directory of the images.The batch_image_resize.sh script accepts these arguments: Let us jump to our shell script to resize image in a batch. If either WIDTH or HEIGHT is missing, then whatever is missing will be automatically calculated to preserve the image aspect ratio:ĪLSO READ: Bash while loop to run command for specific time with examples Sample Shell Script We can resize an image by specifying the scale percentage or the width and height of the output image. Here we are converting JPG format image to PNG. To convert image format we will use covert tool from ImageMagick. It can read and write over 200 image file formats.īefore we go to our shell script, I will show some examples related to ImageMagick ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |