Categories
Applications Command Line (CLI)

cygwin error loading shared libraries

If you’ve been using Cygwin for a while, particularly imageMagick functions such as convert, you may notice some breakages on updating your cygwin version.  Errors such as:

convert: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

– it’s (Cygwin) telling you that there are some libraries missing.  You’ll need to find out which ones and then run the setup/installer to fix it.

To Fix it, first use the cygwin utility ‘cygcheck’ to reveal the names of the missing DLLs.   Since this post references the convert function of imageMagick,  run the command:

cygcheck convert

to generate a list of the missing libraries/DLLs.  For more information, you can check cygwin’s documentation site.  If you’re having trouble with “montage” : then in cygwin run:

cygcheck montage

and it should list out for you the libraries that it cannot find, one such library had the word “gomp” in it.  In the cygwin setup/installer, you’ll find the library just by putting in the last few letters (gomp) should find a match for you (or at least close enough) and click the checkbox to install the library.  Another missing library was TIFF- related.

In my case, it was missing the exact same libraries as cygcheck convert.  Once the install was complete, then the ‘convert’ function was back and running as expected.

HOO-RAY!!!

Categories
Command Line (CLI) Your Choice

Favorite CLI Apps: Imagemagick

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.

Categories
Command Line (CLI) Learning Linux Using Linux

Save time on tasks

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.