Hi!
I'm an IM noob, I went though all the docs and just can't find a way how to solve my problem. I have an image like this http://www.hey.si/slika.jpg, which will serve me as a background of another image http://www.hey.si/ura.jpg. I want the end image to look like this . What are the steps I should take to achieve this ? Before I only used IM for converting and resizing, but now I have this complicated problem. Please help, thank you !
Resizing an image in circle shape
-
- Posts: 1
- Joined: 2011-10-17T13:43:14-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing an image in circle shape
try the following
you have to resize the big image to the size of the small image, you have to create as grayscale mask from the small image and invert (-negate) the black and white, and flood fill the outside of the mask with white. Then you delete the big image and composite the others together.
dim=`convert ura.jpg -format "%wx%h" info:`
convert slika.jpg ura.jpg \
\( -clone 0 -resize $dim! \) \
\( -clone 1 -colorspace gray -negate -fuzz 10% -fill white -draw "color 0,0 floodfill" \) \
-delete 0 -swap 0,1 -compose over -composite result.jpg
Actually, the above still needs a little work as the numerals are not outlined. I will try to fix this later, though not sure exactly when. So anyone else is welcome to improve it.
see
http://www.imagemagick.org/script/escape.php
http://www.imagemagick.org/script/comma ... colorspace
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/draw/#color
you have to resize the big image to the size of the small image, you have to create as grayscale mask from the small image and invert (-negate) the black and white, and flood fill the outside of the mask with white. Then you delete the big image and composite the others together.
dim=`convert ura.jpg -format "%wx%h" info:`
convert slika.jpg ura.jpg \
\( -clone 0 -resize $dim! \) \
\( -clone 1 -colorspace gray -negate -fuzz 10% -fill white -draw "color 0,0 floodfill" \) \
-delete 0 -swap 0,1 -compose over -composite result.jpg
Actually, the above still needs a little work as the numerals are not outlined. I will try to fix this later, though not sure exactly when. So anyone else is welcome to improve it.
see
http://www.imagemagick.org/script/escape.php
http://www.imagemagick.org/script/comma ... colorspace
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/draw/#color