Forum Discussion
Batch convert png to jpg on mac without losing quality?
For mac users, you can use the built-in command line tool sips to batch convert PNG images to JPG format. sips is a powerful image processing command line tool that comes with Mac system, which can be used to query, convert and manipulate the metadata and content of all kinds of image files, and support inter-conversion of multiple image formats.
Use the cd command to switch to the directory containing images you need to convert PNG to JPG on Mac. For example, if your PNG images are stored in the "Images" folder on the desktop, you can enter the following command in the terminal:
cd ~/Desktop/Images
In the target directory, use the following command to convert png to jpg on macOS:
sips --resampleWidth 1024 --setProperty format jpeg *.png --out /Users/user_name/Desktop/Images/JPG
The explanation of the above command is as follows:
--resampleWidth 1024: optional parameter, used to specify the width of the converted JPG images is 1024 pixels, and the height will be adjusted automatically according to the aspect ratio of the original images. You can modify this value according to your actual need, or omit this parameter to keep the size of the original image.
--setProperty format jpeg: specify the format of the converted image as JPG.
*.png: indicates all PNG image files in the current directory. You can modify this wildcard expression to specify a specific file or range of files to be converted.
--out /Users/your username/Desktop/Images/JPG: specifies the output directory of the converted JPG images. Please replace /Users/your username/Desktop/Images/JPG with the path of the directory where you actually want to save the JPG images. If you omit this parameter, the converted JPG images will overwrite the original PNG images.