2

I have a working command. Now I need to know how to apply it to a bunch of files at once so as to automate the process. I tried the below commands and it didn't work. I'm trying to use Imagemagick convert command to perform an operation on 39 PNG files.

P.S. I could not make the code button work to wrap the code in code tags. Will someone please do so for me, thank you.

This command does nothing, just returns to a prompt.

find ./ -name  '*.png'
find ./ -name  '*.png' -exec sh -c 'convert  "$1" -shave 50x50 -bordercolor white -border 1x1 -fuzz 70% -trim "/home/nate/Pictures/trim/${1##*/}"' sh {} \;
find ./ -name  '*.png' -exec sh -c 'for f; do convert  "$f" -shave 50x50 -bordercolor white -border 1x1 -fuzz 70% -trim "/home/nate/Pictures/trim/${f##*/}"; done' sh {} +
while IFS= read -r -d '' file; do filename=`basename "$file"`convert "$file" -shave 50x50 -bordercolor white -border 1x1 -fuzz 70% -trim "/home/nate/Pictures/trim/$filename" done < <(find ./ -name "*.png" -print0)
Tim
  • 33,510
Fudruckers
  • 131
  • 1
  • 6

1 Answers1

0

Ah. Somehow I ended up renaming the png files to numbers. I renamed them with .png. It work. Solved.

Fudruckers
  • 131
  • 1
  • 6
  • I had renamed 39 files from scan-1.png to simply png with no extention. I renamed the files to 1.png, 2.png, 3.png. I simply could not find the files because I was looking for an extension called .png where the files were simply png – Fudruckers Nov 01 '16 at 23:08