Page 1 of 1

Cropping black borders from manuscript

Posted: 2015-10-24T08:29:07-07:00
by toppah
Dear all,

I read a lot on the forums before posting here but I cannot solve my issue, so I hope you can help me dealing with this matter:
I simply would like to remove black borders around my images produced from a digital camera which take pictures of ancient manuscripts.

This is my sample image: https://www.dropbox.com/s/imrs6unowxdte ... X.tif?dl=0

This is the command I am now using and it actually works!

convert IMGP2341DX.tif -bordercolor black -border 1 -fuzz 40% -fill black -draw "color 0,0 floodfill" -shave 1x1 prova.tiff
convert -fuzz 95% -trim prova.tiff fine.tiff

The problem arises when I se up a bash script to loop through the files, the command above does not give the same result.

This is my script: https://www.dropbox.com/s/3eug0mk761x8d ... ge.sh?dl=0


the problem seems to be the following line:
convert ${f} -monitor -bordercolor black -border 1 -fuzz 40% -fill black -draw "color 0,0 floodfill" -shave 1x1 shaved-tmp${f}

if I launch the script with bash -x I see that the command is launched as this:

convert IMGP2341DX.tif -bordercolor black -border 1 -fuzz 40% -fill black -draw 'color 0,0 floodfill' -shave 1x1 prova.tiff

instead of:
convert IMGP2341DX.tif -bordercolor black -border 1 -fuzz 40% -fill black -draw "color 0,0 floodfill" -shave 1x1 prova.tiff

What do you think?

Thanks a lot,

L.

Re: Cropping black borders from manuscript

Posted: 2015-10-24T10:23:48-07:00
by snibgo
What version of IM are you using?
toppah wrote:... the command above does not give the same result.
What is different about the result? Please post the two versions of the image.

I notice the file IMGP2341DX.tif is encoded in AddobeRGB. That won't cause a problem to IM, but some viewers will ignore this and assume the image is sRGB.