If you’re into photography, you would know what crop factor means. I have a Nikon D90 camera with a crop factor of 1.5. For example, if you use a 24mm full frame lens on a D90, the focal length will be 36mm. So, here’s a handy bash script that calculates the crop factor by multiplying the full frame focal length by 1.5.

<pre lang="bash">
if [ $# -eq 0 ]
    echo "Usage: cropfactor.sh 24"
a=$(echo "1.5 * $1" | bc)
echo "Cropfactor focal length is: " $a"mm."


<pre lang="bash">
ulysses@penguin:~/Code$ ./cropfactor.sh 24
Cropfactor focal length is:  36.0mm.