[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How to detect image size?



On 9/19/05, Strong <s-strong mail ru> wrote:
> I have a huge of imges (jpg, bmp, gif) in a huge dirs/subdirs. I want to
> remove those whose height/width is less, say 500 pixels. I looked at
> ImageMagic programs but didn't find one that offers such info. I suppose
> it should be one-two-line bash script. Does anyone knows how to do that?

identify (from image magik) gives the dimensions, you just need to do
a few gynastics to get the output in a form that is useful.

adjust the follow to suit your needs:

find . -name '*.jpg' | xargs -l1 identify -ping | awk '{FILE=$1;
sub("[[].*", "", FILE); X=$3; sub("x.*", "", X); Y=$3; sub(".*x", "",
Y); if ((X<500) || (Y<500)) printf("%s : %ix%i\n", FILE, X, Y)}'


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]