16 July 2008

How to convert an image into another format using Terminal

If you need to change the image format of your screencasts, all you have to do is some tweaking on Terminal. But sometimes, we just want to change the format of a single picture and taking a screenshot of the picture after doing that tweaking, is just too much work. Loading up a CPU-heavy application is also not a good choice if all you want to do is just convert a PNG to a BMP or JPEG.

So, what's the solution? Terminal! That's right, you can use Terminal to do those convertions. For example, to convert an image file input.png into output.bmp use the following command:

sips -s format bmp input.png --out output.bmp

You can also use an option “-z” after the file type specified. This is a resize option. For example the following command:

sips -s format bmp -z 20 20 input.png --out output.bmp

Will convert the image to bmp and then resize it to 20px x 20px.

Check other options here.

Source: Mac Tricks and Tips

No comments: