The following bash script shows how to capture image properties from ImageMagick:

#!/bin/bash
a=`identify xa.jpg`
strarray=($a)
echo 'format: ' ${strarray[1]}
echo 'dimensions: ' ${strarray[2]}
echo 'filesize: ' ${strarray[6]}

xa.jpg is an image which is stored in the same directory as this script.

identify is an ImageMagick utility. The output of identify xa.jpg is:

xa.jpg JPEG 469x264 469x264+0+0 8-bit DirectClass 24.4KB 0.010u 0:00.000

This output is stored in the variable a. The variable is then converted into an array with strarray=($a) command. Each substring (separated by spaces) is now an element of the array strarray. The last three lines extract elements from this array.

Output

format:  JPEG
dimensions:  469x264
filesize:  24.4KB