Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Ok I know about the convert tool and I am wondering can it be used to say just remove the bottom 50 pixels in an image leaving the rest of the image intact.

Can it be done in batch?

Lets say i have 20 images of various sizes and want to remove just the bottom 50 pixels for example the image is of size 800x600 so the new image would be 750x600

If convert cant do this is there anything for linux that can?

share|improve this question

migrated from stackoverflow.com Dec 28 '12 at 13:28

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

Not sure that you cannot do this with convert.

Take a look here:

http://www.imagemagick.org/Usage/crop/#crop

Here is a script which creates thumbnails and identifies the width and height of the original image:

#!/bin/bash
# Define a fixed resolution
long=500
short=600
# Creating thumbnails
(for i in *.png *.jpg; do
width=`identify -format %w $i`
height=`identify -format %h $i`
if [ $width -ge $height ]; then
  size=${long}x
else
  size=x${short}
fi

echo "# Resizing $i $width""x""$height -> $size" ;

convert -resize $size -quality 80 -gravity center -extent $size -background white $i /media/path/to/destination
done
)

You can modify it to fit your needs.

share|improve this answer
    
So im getting 'convert image: -crop lxw+x+y crop.gif' so how do i tell it to use w as the width of the original image and for l to be 50 less than the original image and to start from the top left corer? –  mpeerman Dec 28 '12 at 13:04
    
You should be able to get the width of your original image in this way: 'identify -format "%f,%w,%h"'. The variable w should contain the width. I can post a script later today (have it at home) which might help you. –  Vering Dec 28 '12 at 13:10
    
That would be greatly appreciated. I have tons of images that were sent to me by a friend. and they have timestamps on the bottom corner of each one. He wants me to crop the bottom 50 pixels or so to remove the time/date stamps and then send them back to him so he can have them printed. They are mostly family photos. –  mpeerman Dec 28 '12 at 13:13
    
Have you had a chance yet? –  mpeerman Dec 29 '12 at 4:49
    
First of all, sorry for not answering any sooner, but the question was migrated so I had to talk to the moderators to get this profiles connected so that the answer was recognized as mine (otherwise I cannot comment with no rep). I'll add the script to the answer. –  Vering Jan 2 '13 at 19:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.