Using ImageMagick to get the dimensions of a file (Unix->General)% identify filename.jpgIf you want to be studly, you can use
-formatto tailor the output
% identify -format "insert into bw_graphics values (generate_primary_key(), '/images/llamas/%f', %w, %h);" *.jpg
generates a sqlinsertstatement for each image.