size script

I do a lot of images and one thing i cant think of off the top of my head is sizes of images at larger size so i made a quick script.

Example. Say I have an image thats 400 height and 100 width but i want to start 6 times larger to make sure that it dont pixelize from constant resizing. I would do:

howbig 400 100 6

macbookpro:~ rcg$ howbig 400 100 6
Your current size is Height: 400 x Width: 100; You want to make an image 6 times larger; Your new size will be Height: 2400 x Width: 600

here is the function i wrote You may need to install bc its a command line calculator.

howbig ()
{
height=”$1″;
width=”$2″;
howmuch=”$3″;
newsizeh=$(echo “$height*$howmuch” | bc);
newsizew=$(echo “$width * $howmuch” | bc);
echo “Your current size is Height: $height x Width: $width; You want to make an image $howmuch times larger; Your new size will be Height: $newsizeh x Width: $newsizew”
}

Leave the first comment