nil.enroll(aetheric_username, quantum_class_id) (adric) wrote,
nil.enroll(aetheric_username, quantum_class_id)
adric

  • Location:
  • Music:

./sizes *.jpg

I got this working pretty quickly and it involved clevering out some arcana, including how to do math with the output of your pipes(?!). Also, if will help me reorganize the wallpaper collection. Exif is a neat tool if you don't have it.


#!/bin/bash
## print images files and their pixel sizes, for wallpaper
## might take target from first argument
## requires exif package, available in apt

for image in *.jpg; ##$1;
do
while exif --tag PixelXDimension $image 2>&1 > /dev/null ;
do
echo -n $image " "
echo -n $((`exif --tag PixelXDimension $image | grep Value | tail -1 | awk '{print $2}'`/2)) x" "
echo -n $((`exif --tag PixelYDimension $image | grep Value | tail -1 | awk '{print $2}'`/2)) y
echo;
break;
done
done

Sample output:

400177main_MilkyWayCenterComp3000.jpg 1500 x 1200 y


I'm sure none of you care much but I'm quite pleased I was able to figure this out in only a couple tries**

ETA: fixes, works well though there is still some error junk in the output, even with the 2>&1 > dev/null incantation.


**The hours wasted fighting with gem, ImageMagick, macports (sudo mv /opt/not.opt), and make last week will not be spoken of. Take one point from ruby and put it into bash's bucket.
Tags: hack
Subscribe

  • Walk?

    *pant* Well, just got back from a short walk around the complex (I restrain myself from the term neighbourhood), and it went pretty well. I listened…

  • Please *do* glorify some great hackers and not crime

    Please *do* glorify some great hackers and not crime Re: "Stop Glorifying Hackers"(sic) from the M. McWhorter, I'm sorry you had trouble safely…

  • MCU for Fall and Winter 2013

    The Keanu movie about the ronin was not as bad as the trailer led us to believe it would be. I saw it in a theatre with an aikido afficianado and…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments