Welcome to nixCraft forum!
You can try identify command:
Output:
2009.jpg JPEG 1024x768 DirectClass 91kb 0.000u 0:01
For more info pass -verbose option to command:
Code:
identify -verbose networking.jpg
Output:
Code:
Format: JPEG (Joint Photographic Experts Group JFIF format)
Geometry: 488x281
Class: DirectClass
Colorspace: RGB
Type: TrueColor
Depth: 8 bits
Endianess: Undefined
Channel depth:
Red: 8-bits
Green: 8-bits
Blue: 8-bits
Channel statistics:
Red:
Min: 0
Max: 255
Mean: 221.43
Standard deviation: 69.9033
Green:
Min: 0
Max: 255
Mean: 228.501
Standard deviation: 55.7455
Blue:
Min: 0
Max: 255
Mean: 238.427
Standard deviation: 41.9074
Colors: 24088
Rendering-intent: Undefined
Resolution: 72x72
Units: Undefined
Filesize: 22kb
Interlace: None
Background Color: grey100
Border Color: #DFDFDF
Matte Color: grey74
Dispose: Undefined
Iterations: 0
Compression: JPEG
Orientation: Undefined
JPEG-Quality: 75
JPEG-Colorspace: 2
JPEG-Sampling-factors: 2x2,1x1,1x1
signature: e50adabb6c5f76a4aa0caf8e28dbecf19bd46a19ecd230007387a6cc3a744038
Tainted: False
User Time: 0.010u
Elapsed Time: 0:01
Here is a script:
Code:
#!/bin/bash
function die(){
echo $@
exit 1
}
# fallback
[ $# -eq 0 ] && die "Syntax: $0 image-file-name" || file=$1
IDEN=$(which identify)
[ $? -eq 1 ] && die "Command identify not found. Install imagemagick package" || :
# get data
size=$($IDEN -verbose $file | grep size | awk '{ print $2}')
resolution=$($IDEN -verbose $file | grep Resolution | awk '{ print $2}')
compression=$($IDEN -verbose $file | grep Compression | awk '{ print $2}' )
# display back
echo "Image name - $file"
echo "Image size - $size"
echo "Image resolution - $resolution"
echo "Image compression - $compression"
Read man page of identify command for more info and make sure package imagemagick is installed
