Posts Tagged ‘graphics’

Favorite CLI Apps: Imagemagick

02.19.10

Posted by adamlinuxhelp  |  No Comments »

Imagemagick

Imagemagick is an awesome command-line based image manipulation tool.

[Paraphrased from the imagemagick manual:]

ImageMagick®, is a software suite to create, edit, and compose bitmap images. It can  read,  convert  and  write  images in a variety of formats. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform  images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bezier curves.  ImageMagick  includes a number of command-line utilities for manipulating images. Most of you are probably accustom to editing images one at a time with a graphical user interface (GUI) with such programs  as gimp or Photoshop. However, a GUI is not always convenient. Suppose you want to process an image dynamically or you want to apply  the  same  operations  to  many images  or  repeat  a  specific  operation at different times to the same or different image. For these types of operations, the command-line image processing utility is appropriate.

To install imagemagick, use Synaptic, or issue the following command in a terminal

sudo aptitude install imagemagick

Visit my post on using Imagemagick to perform the same process on multiple images.

There are many examples on the imagemagick website.

Favorite Linux Apps: Photo & Image

02.12.10

Posted by adamlinuxhelp  |  No Comments »

Linux Gui Applications for Photos and Image-based tasks

If you like to store your digital photos in “album-style” format, then I recommend Digikam.  It’s a KDE-based app so I suggest installing it using Synaptic on Debian-based systems.  Let Synaptic fetch other files as needed.  This saves you the headaches of “dependency hell”, which happens when an app you wish to install needs additional files and you have no idea which ones, where to find them, or how to properly install them.

To manipulate photos and images (such as cropping, or layering text captions onto them) I suggest you install the GIMP if it’s not there by default.  To find out if you have it, you can check your Applications menu or issue the following command in a terminal

which gimp

If the shell returns something like “/usr/bin/gimp“, then its installed.  If it returns nothing, you’ll need to install it.  The GIMP also does scaling (resizing images while keeping the aspect ratio) and is the closest freeware knockoff of Adobe Photoshop to my knowledge.

When I say “closest” I implore you to decide for yourself if your tasks can be done with free software.  The GIMP has a lot of great features such as transparency, layers, gradients, and more; but IT IS NOT CAPABLE of replacing Photoshop if that’s what your work requires.

If you’re doing commercial graphical work, your software choice (and budget) should be “an investment” and not “an expense”.  For many personal uses, the GIMP may be able to give you professional-looking results.

Save time on tasks

01.08.10

Posted by adamlinuxhelp  |  No Comments »

Learning basic Linux commands helps save you time when working on repetitive tasks.

Imagine you had a folder of images in *.bmp format.  File sizes of bmps are larger than jpg files because they contain more information.  To convert these bmp files to jpgs you could open a .bmp file in a graphics program (such as photoshop), select processes (such as ‘save for web’), set the format to convert to, and finally, save the file “as” filename.jpg.  Converting each image takes about five to six “manual” steps, depending on how you opened the source files and where you save the destination files.  If you had a folder with 100 images, it becomes tedious repetition.  There are better ways to do this.

You could create a batch process or “macro” in your graphics app that lets you record the individual steps performed on a single image, and then point the macro at a folder of source images and a folder to save the converted images.  Photoshop has “batch processing” that handles this fine.  Other programs (such as THE GIMP) are “scriptable” but some knowledge of Python is probably a must.

So we now have a way to convert images en masse with a GUI app, but is it the most efficient way? Is it reusable? It is reusable but you’ll probably have to reset the macro/batch settings if your source and destination folders change the next time you had to convert a lot of images.

Is there a quicker way to accomplish the same thing more or less?  There is, in my opinion, a better way perform mass image conversion in a predictable, reliable way.  It requires the command line terminal and an application known as “ImageMagick“.

Using Linux (the bash shell and ImageMagick) here are the 2 steps:

1. Use the “cd” command to get to the directory that has the bmp images
2. Issue this command:  mogrify -format jpg *.bmp
The above command was found at http://www.ofzenandcomputing.com/zanswers/1016 and I thank them for posting it.  It accomplished in one line the same work as a 50-line shell script.
Result: All of your bmp files have been converted and saved-as jpgs in the same directory
Warning: the “mogrify” command usually replaces the source, but when changing formats, Imagemagick is intelligent enough not to destroy the original bmp file.

2a. To store the new files in a folder other than the source (e.g. “bmpFiles/jpgs”), add the -path option in front of -format.  The command becomes:  mogrify -path jpgs/ -format jpg *bmp
The folder specified by -path must first exist, or the command will fail.