convert in ImageMagick resize by percent
2013-04-09 10:44
495 查看
#!/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..... :-(
相关文章推荐
- Pop Open Image and Resize Window in ASP.net
- Region Filling and Object Removal by Exemplar-Based Image Inpainting-code-2004
- ruby -- 问题解决(八)解决Paperclip::NotIdentifiedByImageMagickError
- Cloudera: Start Impala service by cloudera manager in docker quickstart image
- image operation by GraphicsMagick(nodejs)
- ImageMagick Errors: Convert PDF to Images
- How to Pop Open an image window that resizes to fit the image in ASP.net 1.x and 2.0 Beta 1
- Region Filling and Object Removal by Exemplar-Based Image Inpainting-code-2004(代码改进)
- How to load an ImageView by URL in Android
- Convert SVG to PDF by using iText in Java(ZT)
- ImageMagick convert命令
- Convert SVG to PDF by using iText in Java(ZT)
- linux下ImageMagick convert命令
- iOS---stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead,
- ImageMagick convert命令
- Step-by-step guide to installing the Automatic Image Slider w/ CSS & jQuery from Soh Tanaka in Zen Cart
- ImageMagick convert命令
- This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use
- ImageMagick convert命令