To reduce the size of a JPG image on Ubuntu (from MB to KB), you can use the convert command from the ImageMagick package. Here's how to do it:
Install ImageMagick
If it's not already installed, you can install it using:
Reduce Image Size
Use the following command to compress the image:
Explanation:
input.jpg: The original image file.-quality 75: Sets the compression level (1–100). Lower values reduce file size but can decrease image quality.output.jpg: The compressed image.
Additional Options for Further Size Reduction:
Resize the image to smaller dimensions:
This reduces the width and height by half.
Specify exact dimensions:
Replace
800x600with your desired resolution.Strip metadata to save space:
Check the Resulting File Size
Use ls to verify the new file size:
Automating the Process for Multiple Files
To compress all JPG files in a directory:
No comments:
Post a Comment
If you have any doubts, please let me know.