ImageMagick Batch Image Conversion Primer Tutorial

ImageMagick Batch Image Conversion Primer Tutorial

ImageMagick Batch Image Conversion Primer Tutorial

You can read Gimp Batch Image Manipulation Primer Tutorial back in the past to read about a “what used to be” command line image manipulation “batch processing” partner to the excellent GUI Gimp image editor product. Why is “batch” image editing interesting? Well, just take the case of …

  • iOS (iPhone or iPad) image set in Photos app …
  • tap Share icon …
  • tap Select icon …
  • tap the relevant images to share …
  • tap Mail icon …
  • fill in To emailee and Subject fields …
  • tap Send …
  • then you are presented with the choices …
    1. Small
    2. Medium
    3. Actual Size

And then you find out whether the Mail data size limits have been exceeded or not, and the other matter of interest is whether other apps using these images at the emailee’s end can handle the respective image sizes. We took an interest in the reinstalling of the great ImageMagick product’s command line applications …

  • convert
  • mogrify

… that latter application capable of command line “batch style” conversions between image formats (and qualities, in the case of output JPEG) … for example …


mogrify -quality 60 -format jpg backyardbirdcount/*.PNG

… as a way for us picking “Medium” above related to Citizen Science Primer Tutorial‘s source iPhone via iOS (iPhone) Home-and-Right-Top-buttons simultaneously (macOS is Command-Control-Shift-3) screenshotting images via (iOS) Photos app images we used to attempt to create an animated GIF via our inhouse Animated GIF Creator PHP web application, being too much to handle as those “Medium” PNGs, but okay, after ImageMagick “mogrify” batch conversions (via above command). And so we have three scenarios to see here (via macOS Terminal application) …

“Medium” PNG sizes …
-rw-rw-r–@ 1 user admin 949079 23 Oct 14:21 backyardbirdcount/IMG_1544.PNG
-rw-rw-r–@ 1 user admin 587441 23 Oct 14:21 backyardbirdcount/IMG_1545.PNG
-rw-rw-r–@ 1 user admin 593868 23 Oct 14:21 backyardbirdcount/IMG_1546.PNG
-rw-rw-r–@ 1 user admin 248811 23 Oct 14:21 backyardbirdcount/IMG_1547.PNG
-rw-rw-r–@ 1 user admin 264369 23 Oct 14:21 backyardbirdcount/IMG_1548.PNG
-rw-rw-r–@ 1 user admin 345073 23 Oct 14:21 backyardbirdcount/IMG_1549.PNG
-rw-rw-r–@ 1 user admin 638168 23 Oct 14:21 backyardbirdcount/IMG_1550.PNG
-rw-rw-r–@ 1 user admin 697660 23 Oct 14:21 backyardbirdcount/IMG_1551.PNG
-rw-rw-r–@ 1 user admin 1132884 23 Oct 14:21 backyardbirdcount/IMG_1552.PNG
-rw-rw-r–@ 1 user admin 101361 23 Oct 14:21 backyardbirdcount/IMG_1553.PNG
-rw-rw-r–@ 1 user admin 900161 23 Oct 14:21 backyardbirdcount/IMG_1554.PNG
-rw-rw-r–@ 1 user admin 534093 23 Oct 14:21 backyardbirdcount/IMG_1555.PNG
-rw-rw-r–@ 1 user admin 706118 23 Oct 14:21 backyardbirdcount/IMG_1556.PNG
-rw-rw-r–@ 1 user admin 262429 23 Oct 14:21 backyardbirdcount/IMG_1557.PNG
-rw-rw-r–@ 1 user admin 142314 23 Oct 14:21 backyardbirdcount/IMG_1558.PNG
-rw-rw-r–@ 1 user admin 142314 23 Oct 14:21 backyardbirdcount/IMG_1559.PNG
-rw-rw-r–@ 1 user admin 97603 23 Oct 14:21 backyardbirdcount/IMG_1560.PNG
-rw-rw-r–@ 1 user admin 116648 23 Oct 14:21 backyardbirdcount/IMG_1561.PNG
-rw-rw-r–@ 1 user admin 113955 23 Oct 14:21 backyardbirdcount/IMG_1562.PNG
-rw-rw-r–@ 1 user admin 409038 23 Oct 14:21 backyardbirdcount/IMG_1563.PNG
-rw-rw-r–@ 1 user admin 116669 23 Oct 14:21 backyardbirdcount/IMG_1564.PNG
-rw-rw-r–@ 1 user admin 125601 23 Oct 14:21 backyardbirdcount/IMG_1565.PNG
-rw-rw-r–@ 1 user admin 125152 23 Oct 14:21 backyardbirdcount/IMG_1566.PNG
-rw-rw-r–@ 1 user admin 139855 23 Oct 14:21 backyardbirdcount/IMG_1567.PNG
-rw-rw-r–@ 1 user admin 148579 23 Oct 14:21 backyardbirdcount/IMG_1568.PNG
-rw-rw-r–@ 1 user admin 137468 23 Oct 14:21 backyardbirdcount/IMG_1569.PNG
-rw-rw-r–@ 1 user admin 779736 23 Oct 14:21 backyardbirdcount/IMG_1570.PNG
-rw-rw-r–@ 1 user admin 769960 23 Oct 14:21 backyardbirdcount/IMG_1571.PNG
ImageMagick mogrify “Medium” PNG to JPEG 60% quality …
-rw-r–r– 1 user admin 25880 23 Oct 15:42 backyardbirdcount/IMG_1544.jpg
-rw-r–r– 1 user admin 28823 23 Oct 15:42 backyardbirdcount/IMG_1545.jpg
-rw-r–r– 1 user admin 16981 23 Oct 15:42 backyardbirdcount/IMG_1546.jpg
-rw-r–r– 1 user admin 58726 23 Oct 15:42 backyardbirdcount/IMG_1547.jpg
-rw-r–r– 1 user admin 48078 23 Oct 15:42 backyardbirdcount/IMG_1548.jpg
-rw-r–r– 1 user admin 54603 23 Oct 15:42 backyardbirdcount/IMG_1549.jpg
-rw-r–r– 1 user admin 25001 23 Oct 15:42 backyardbirdcount/IMG_1550.jpg
-rw-r–r– 1 user admin 16881 23 Oct 15:42 backyardbirdcount/IMG_1551.jpg
-rw-r–r– 1 user admin 50545 23 Oct 15:42 backyardbirdcount/IMG_1552.jpg
-rw-r–r– 1 user admin 17170 23 Oct 15:42 backyardbirdcount/IMG_1553.jpg
-rw-r–r– 1 user admin 24021 23 Oct 15:42 backyardbirdcount/IMG_1554.jpg
-rw-r–r– 1 user admin 30952 23 Oct 15:42 backyardbirdcount/IMG_1555.jpg
-rw-r–r– 1 user admin 18575 23 Oct 15:42 backyardbirdcount/IMG_1556.jpg
-rw-r–r– 1 user admin 63195 23 Oct 15:42 backyardbirdcount/IMG_1557.jpg
-rw-r–r– 1 user admin 44092 23 Oct 15:42 backyardbirdcount/IMG_1558.jpg
-rw-r–r– 1 user admin 44092 23 Oct 15:42 backyardbirdcount/IMG_1559.jpg
-rw-r–r– 1 user admin 25304 23 Oct 15:42 backyardbirdcount/IMG_1560.jpg
-rw-r–r– 1 user admin 31509 23 Oct 15:42 backyardbirdcount/IMG_1561.jpg
-rw-r–r– 1 user admin 31354 23 Oct 15:42 backyardbirdcount/IMG_1562.jpg
-rw-r–r– 1 user admin 27136 23 Oct 15:42 backyardbirdcount/IMG_1563.jpg
-rw-r–r– 1 user admin 31401 23 Oct 15:42 backyardbirdcount/IMG_1564.jpg
-rw-r–r– 1 user admin 36245 23 Oct 15:42 backyardbirdcount/IMG_1565.jpg
-rw-r–r– 1 user admin 36133 23 Oct 15:42 backyardbirdcount/IMG_1566.jpg
-rw-r–r– 1 user admin 40717 23 Oct 15:42 backyardbirdcount/IMG_1567.jpg
-rw-r–r– 1 user admin 40461 23 Oct 15:42 backyardbirdcount/IMG_1568.jpg
-rw-r–r– 1 user admin 39587 23 Oct 15:42 backyardbirdcount/IMG_1569.jpg
-rw-r–r– 1 user admin 21890 23 Oct 15:42 backyardbirdcount/IMG_1570.jpg
-rw-r–r– 1 user admin 16944 23 Oct 15:42 backyardbirdcount/IMG_1571.jpg
“Small” PNG sizes …
-rw-rw-r–@ 1 user admin 261455 23 Oct 14:46 IMG_1544.PNG
-rw-rw-r–@ 1 user admin 191175 23 Oct 14:46 IMG_1545.PNG
-rw-rw-r–@ 1 user admin 165294 23 Oct 14:46 IMG_1546.PNG
-rw-rw-r–@ 1 user admin 248811 23 Oct 14:46 IMG_1547.PNG
-rw-rw-r–@ 1 user admin 264369 23 Oct 14:46 IMG_1548.PNG
-rw-rw-r–@ 1 user admin 345073 23 Oct 14:46 IMG_1549.PNG
-rw-rw-r–@ 1 user admin 188451 23 Oct 14:46 IMG_1550.PNG
-rw-rw-r–@ 1 user admin 197718 23 Oct 14:46 IMG_1551.PNG
-rw-rw-r–@ 1 user admin 320042 23 Oct 14:46 IMG_1552.PNG
-rw-rw-r–@ 1 user admin 101361 23 Oct 14:46 IMG_1553.PNG
-rw-rw-r–@ 1 user admin 246993 23 Oct 14:46 IMG_1554.PNG
-rw-rw-r–@ 1 user admin 179694 23 Oct 14:46 IMG_1555.PNG
-rw-rw-r–@ 1 user admin 201494 23 Oct 14:46 IMG_1556.PNG
-rw-rw-r–@ 1 user admin 262429 23 Oct 14:46 IMG_1557.PNG
-rw-rw-r–@ 1 user admin 142314 23 Oct 14:46 IMG_1558.PNG
-rw-rw-r–@ 1 user admin 142314 23 Oct 14:46 IMG_1559.PNG
-rw-rw-r–@ 1 user admin 97603 23 Oct 14:46 IMG_1560.PNG
-rw-rw-r–@ 1 user admin 116648 23 Oct 14:46 IMG_1561.PNG
-rw-rw-r–@ 1 user admin 113955 23 Oct 14:46 IMG_1562.PNG
-rw-rw-r–@ 1 user admin 155992 23 Oct 14:46 IMG_1563.PNG
-rw-rw-r–@ 1 user admin 116669 23 Oct 14:46 IMG_1564.PNG
-rw-rw-r–@ 1 user admin 125601 23 Oct 14:46 IMG_1565.PNG
-rw-rw-r–@ 1 user admin 125152 23 Oct 14:46 IMG_1566.PNG
-rw-rw-r–@ 1 user admin 139855 23 Oct 14:46 IMG_1567.PNG
-rw-rw-r–@ 1 user admin 148579 23 Oct 14:46 IMG_1568.PNG
-rw-rw-r–@ 1 user admin 137468 23 Oct 14:46 IMG_1569.PNG
-rw-rw-r–@ 1 user admin 217599 23 Oct 14:46 IMG_1570.PNG
-rw-rw-r–@ 1 user admin 210131 23 Oct 14:46 IMG_1571.PNG

We show our

  1. reinstalling ImageMagick on macOS (for this MacBook Air) … via HomeBrew … and also show a reinstall of HomeBrew in the process … via …

    brew install imagemagick
    brew install ghostscript
  2. make the image set smaller in size via ImageMagick mogrify command …

    mogrify -quality 60 -format jpg backyardbirdcount/*.PNG
  3. show resultant image sets to show that the quality reduction was not bad (and also helped us create Citizen Science Primer Tutorial‘s animated GIF presentation)

Interesting, huh?!


Previous relevant Gimp Batch Image Manipulation Primer Tutorial is shown below.

Gimp Batch Image Manipulation Primer Tutorial

Gimp Batch Image Manipulation Primer Tutorial

Gimp is a great graphics editor with a huge number of methods to subtlely or not so subtlely adjust your images, no matter where they have come from (some of today’s came from Mac OS X screen captures via the Grab application and some came from a digital camera).

Gimp has a great and practical way to manipulate a batch of files to perform the task to this series of photographs. This could be especially useful for website imagery work.

In today’s tutorial you see one batch run changing the images to black and white and another to change the size of a series of photographs (to a smaller size than the huge size they come out of the digital camera (ie. more suited to website usage)) and add a text watermark in the top left hand corner.

Here is some downloadable PHP that helps out (after) the second batch approach to show up to six of the resized images at a time and change these images over time, and you could call it CuteButtons.php … this PHP arrangement (it is possible to do this same functionality just with Javascript, but is maybe easier to achieve in PHP, as well as there being methods like file_exists and file_get_contents and copy which are things (client-side) Javascript will never be able to do (well, maybe first of three in a clunky way)) is generic in the sense that there are hardcoded image names, but they can be overridden by using get parameters image1, image2, image3 etcetera etcetera etcetera …
eg. //www.rjmprogramming.com.au/GIMP/Bimp/CuteButtons.php?image1 =HTTP://www.rjmprogramming.com.au/GIMP/iPhoto/NLook.jpg&image2 =HTTP://www.rjmprogramming.com.au/GIMP/iPhoto/NLok.jpg

The Gimp of this tutorial is on a Mac laptop using Mac OS X 10.9.2 Mavericks. A curious thing happened with trying to get Batch Image Manipulation to work. It worked to a point but, initially, wouldn’t accept images when clicking the “Add image files” button. Read somewhere that this is less likely to happen when installing via MacPorts (presumably via port install gimp) but I installed via the Gimp website. Am not sure that it was all a coincidence, or was a dream, but seem to remember what made Gimp’s Batch Image Manipulation functionality to fully start working, was an “out there” idea I tried that was to download the gimp-plugin-bimp.zip in which there was a Windows bimp.exe (Gimp plugin), which I ran on Mac using the Terminal application’s Bash environment’s command wine via wine bimp.exe (we installed wine here via MacPorts port install wine and talked about wine with Wine for Windows on Mac Primer Tutorial). Just thought I’d mention this in case it helps somebody. My theory for the turn around is that this may have written something good to a configuration file (even before it failed to run (as you’d expect) with various Windows graphics libraries not loading).

Gimp’s Batch Image Manipulation (bimp) runs as a new application (as you can see in the tutorial), as you might expect would happen for (my favourite) XQuartz (formerly XWindows (see a future XWindows Primer Tutorial for more information here)) type of program (as Gimp is).

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, iOS, Operating System, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>