0

I want to keep a collection of images (which arrive via RSS) on a shared network drive (for anyone to have SFW desktop backgrounds).

However, some of the images that arrive are absurdly small (85x75, for example).

How can I ensure that all images in the directory are of a minimum size (eg 1366x768)? I want to be able to maintenance on the directory so that too-small images are not kept.

6
  • 2
    askubuntu.com/a/155083/295286 Commented Apr 14, 2015 at 14:26
  • have you tried file XYZ ? Commented Apr 14, 2015 at 14:27
  • 1
    superuser.com/questions/275502/… Commented Apr 14, 2015 at 14:27
  • @Archemar I tried that, only gives filetype, that's all Commented Apr 14, 2015 at 14:28
  • 1
    @YoMismo right, so this wouldn't be useful if images the OP receives are in different format that png, right ? Commented Apr 14, 2015 at 14:41

3 Answers 3

3

Use imagemagick :

identify -format "%w×%h\n" foo.png 

or graphicsmagick :

gm identify -format "%w×%h" clipart-playback-buttons-d1e5.png 

(graphicsmagick adds a newline by default)

Those print width×height, e.g. 85×75 or 4328×4278. Identify can show you other information of the image, too.

1
  • this looks like just what I'm looking for - @Serg mentioned it in a comment off AskUbuntu, too Commented Apr 14, 2015 at 15:08
1

You may try whether the picture data contain EXIF Information; in that case you can use exiftool, e.g.:

$ exiftool -S dscn0986.jpg dscn0986_th.jpg | grep ^Image ImageWidth: 1024 ImageHeight: 768 ImageSize: 1024x768 ImageWidth: 128 ImageHeight: 128 ImageSize: 128x128 
0

Depends on the system you are running of course. In Linux, you should be able to do 'file ' and see the size in the output which you can then parse and make decisions from.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.