On Wed, Apr 9, 2014 at 3:03 AM, Kevin O'Gorman <
kogorman@gmail.com> wrote:
> I have a few hundred screen shots I want to put on a web page, but
> they are all full-screen and I want to crop to the real contents.
> This is an identical region in all cases. So I want to script it.
>
> So, 2 questions:
> A) What's the best tool for the job? Gimp, irfanview, or something else?
> B) Is there a script already in existence where I can just change the
> crop rectangle? I really don't want to learn a new language for a
> one-time job.
>
SOLVED. Thanks to whoever gave me the clue that convert(1) could do the cropping. That and 2 bash scripts do all the work.
Since what I start with is batches of 150 screenshots, I move them onto a portable drive using my Windows laptop, then on Linux I rename them from the awkward scheme used by my device (Kindle HDX) with bash:
---------------------------------
#!/bin/bash
if [ $# != 1 ] ; then
echo Needs exactly one argument
exit 1
fi
name=$1
x=1
for i in *.png ; do
mv $i $(printf "$name-%03i.png" $x)
(( x++ ))
done
-------------------------------
Then, with a batch in it's own directory, since the cropping is always exactly the same:
---------------------------------
#!/bin/bash
if [ $# != 0 ] ; then
echo Needs no argument
exit 1
fi
for i in *.png ; do
convert $i -crop 1600x1600+0+530\! -resize "12.5%" ../Curated/$i
done
---------------------------------