User Tools

Site Tools


images:cut_image_background

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

images:cut_image_background [2017/03/09 14:48] – created peterimages:cut_image_background [2019/11/29 16:26] (current) – removed peter
Line 1: Line 1:
-====== Images - Cut Image Background ====== 
  
-Using ImageMagick, here's a small sequence of commands to cut the image of background (given that background is a solid color): 
- 
-<code bash> 
-ORIG_IMAGE_NAME=green.jpg; 
-NEW_IMAGE_NAME=green-trans.png; 
-TMP_COLOR=`convert $ORIG_IMAGE_NAME -crop 1x1+0+0 txt:- | sed -n 's/.*\(#\S\+\).*/\1/p'`; 
-convert $ORIG_IMAGE_NAME -bordercolor $TMP_COLOR -border 1x1 -alpha set -channel RGBA -fuzz 30% -fill none -floodfill +0+0 $TMP_COLOR -shave 1x1 $NEW_IMAGE_NAME 
-</code> 
-Just change the first to vars. You can also adjust the fuzz percentage if needed. 
images/cut_image_background.1489070909.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki