try the script below.
See the comments in the script for usage and dependencies.
tested on slackware 13.1
#!/bin/bash
#Script By Francisco Dalla Rosa Soares - 2010/06/21
#
#USAGE: teste.sh <directory to search> <what to search>
#
#EXAMPLE: teste.sh /home/myuser *.jpg
#
#The script will return the path to the files that meet the image dimensions specified.
#
#Image dimensions are in the array WALLPAPERSIZE.
#You can add or remove sizes as you want.
#This script DEPENDS on exiv2 for checking image dimensions
WALLPAPERSIZE=( 800x600 1024x768 1200x600 1680x1050 1920x1200 1280x800 1600x1200 1280x1024 )
for i in $(find $1 -iname $2); do
FILENAME=`exiv2 $i 2>/dev/null | grep "name" | awk -F: '{print $2}'`;
IMAGESIZE=`exiv2 $i 2>/dev/null | grep "Image size" | awk -F: '{print $2}'| sed 's/ //g'`;
for j in ${WALLPAPERSIZE[@]}; do
if [ $j == $IMAGESIZE ]
then
echo $FILENAME;
fi
done
done
Last edited by frandalla; 06-21-2010 at 07:30 PM.
Reason: typo correction
|