imagemagick - Bash output image dimensions of all files with a specific name -


i want go through album artwork images in music folder, and

  1. make sure album covers square (width = height)
  2. make sure album covers have minimum width of 500px

i found several things each of these, i'm painfully slow bash, , can't quite figure out. closest i've come this:

find /mnt/2tb_1/music/archive/complete -mindepth 2 -maxdepth 2 -type d -exec echo identify -format "%wx%h" "{}/folder.jpg" ';' -fprint0 /mnt/2tb_1/music/output.txt 

this looking @ correct folder depth. when run this, command prompt shows dimensions correct folder.jpgs, , output.txt file has paths (without line breaks). however, need them in 1 place (and preferably in output.txt file, since there lot of folder.jpg files at).

i wouldn't turn down bash script filtering mentioned, i'm quite willing settle output like:

w  xh   path 500x500 /mnt/2tb_1/music/archive/complete/artist1/album1/folder.jpg 500x500 /mnt/2tb_1/music/archive/complete/artist1/album2/folder.jpg 350x350 /mnt/2tb_1/music/archive/complete/artist2/album1/folder.jpg 

from there, can throw in spreadsheet , analasys.

not sure issue is, or how files should close seem want:

find /mnt/2tb_1 -name folder.jpg -exec identify -format "%g %m\n" {} \; 

you can add in exclusions , depths , things again once works how want, or delete stuff don't need in excel.

if want output file (called list.txt), use:

find ... > list.txt 

if want analyse file , find images not square or narrower 500 pixels, use awk, this:

awk -f'[x ]' '($1!=$2)||($1<500)' list.txt 

the -f'[x ]' tells awk split fields on each line using either x in dimensions or space. means width gets put in field $1 , height in field $2. maths easy.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -