Converting and manipulating image files on the Linux command line | Virtual Tech
Most of us probably know how wonderful a tool Gimp is for editing images, but have you ever thought about manipulating image files on the command line? If not, let me introduce you to the convert command. It easily coverts files from one image format to another and allows you to perform many other image manipulation tasks, as well — and in a lot less time than it would take to make these changes uses desktop tools.
Let’s look at some simple examples of how you can make it work for you.
Converting files by image type
Coverting an image from one format to another is extremely easy with the convert command. Just use a convert command like the one in this example:
$ convert arrow.jpg arrow.png
The arrow.png image should look the same as the original arrow.jpg file, but the file will have the specified file extension and be different in size. The convert command will use the file name you provide (in this case, arrow.png) to determine what type of file you want to end up with and reformat the image accordingly. If you doubt that the proper conversion could possibly happen as quickly and easily as it does, you can always use the od command to examine the beginning of each of your files.
od -bc arrow.jpg | head -6 0000000 377 330 377 340 000 020 112 106 111 106 000 001 001 000 000 001