convert in ImageMagick resize by percent
#!/bin/bash
image="/media/C/1.jpg" result="/media/C/12.jpg" width=`convert $image -format "%w" info:` height=`convert $image -format "%h" info:` #Now convert your percentages to pixels as variables, for example xoff=`convert xc: -format "%[fx:$width*10/100]" info:` yoff=`convert xc: -format "%[fx:$height*10/100]" info:` ww=`convert xc: -format "%[fx:$width*40/100]" info:` hh=`convert xc: -format "%[fx:$height*40/100]" info:` #then put that into your crop convert $image -crop ${ww}x${hh}+${xoff}+${yoff} +repage $result echo 'done'
above is crop, ref to : http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=17441
the following is resize by percentage:
ref to : http://www.imagemagick.org/Usage/resize/#percent
convert dragon.gif -resize 50% half_dragon.gif convert terminal.gif -resize 50% half_terminal.gif
such simple ,but i have done it in hard way to finish this percentage resize task..... :-(