InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Mac Command Line tutorials

  • Bulk convert jpeg files to png using sips on mac
  • Custom terminal tab title and ssh on mac
  • How to convert text to speech on Mac using command line utility say
  • How to join multiple pdf files on Mac
  • How to use qpdf to add/remove password from pdf on mac
  • Install redis on Mac
  • Mac - find which process is listening on a port
  • Mac - hide and unhide a file or directory
  • Mac - open a terminal from a folder
  • Mac - print java home on command line
  • Mac - search files on command line using mdfind
  • Mac command line convert svg to png
  • Mac command line utility open - some handy tips for better productivity
  • Mac terminal - how to close shell on exit
  • mac pkgutil - quick start guide
 
  • Home
  • > Tutorials
  • > Mac
  • > Mac Command Line

Bulk convert jpeg files to png using sips on mac

By admin on Sep 29, 2015

mac sips (scriptable image processing system) is a very handy tool to convert image from one format to another. This can also be used to automate converting bulk images. We’ll use sips to convert all jpeg images to png in this article.

Use sips to convert one file

Use the following command to convert on file from jpeg to png format:

$ sips -s format png myimage.jpeg --out myimage.png

Create bash script to bulk convert

Create a bash script and call it bulk_jpeg_to_pngs.sh and put the following content in it:

#!/bin/bash
DIR=$1
cd $DIR
for i in  *.jpeg ; do
  j=$(echo -n $i | sed -e 's/.jpeg/.png/g')
  echo "--converting $i to $j"
  sips -s format png "$i" --out "$j"
done

Run bash script to bulk convert

Create a folder imgdir and keep two jpeg files file1.jpeg and file2.jpeg in it. You can keep any number of files with any names. Run the following command:

$ chmod a+x bulk_jpeg_to_pngs.sh
$ ./bulk_jpeg_to_pngs.sh /pathto/imgdir
--converting file1.jpeg to file1.png
/pathto/imgdir/file1.jpeg
  /pathto/imgdir/file1.png
--converting file2.jpeg to file2.png
/pathto/imgdir/file2.jpeg
  /pathto/imgdir/file2.png

Make sure you take a backup of your image directory before running this command. This will avoid any accidental loss of file due to overwrite.

Suggested posts:

  1. How to enable usb debugging on android
  2. Mac – open a terminal from a folder
  3. How to check if a user has password on Linux
  4. HTML5 canvas draw image examples
  5. Find used ports by an app on Android using Adb
  6. Jenkins how to clone a project
  7. PHP – How to log custom data in apache access log
  8. how to debug javascript in Chrome
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Mac, Mac Command Line, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress