I'm getting a white box I hadn't expected. Does anyone know why? Here I am attempting to create a tiled background, then composite an image on top. This is just enough of a larger command to demonstrate the issue.
: unexpected white box
convert -size 1x1 xc:blue ^
-filter point -virtual-pixel tile -define distort:viewport=250x150+0+0 -distort SRT 0 +repage ^
( rose: -rotate 10 -geometry +50+50 ) -composite ^
out_1.png
: shows size of white box to be 250x150
convert -size 1x1 xc:blue ^
-filter point -virtual-pixel tile -define distort:viewport=250x150+0+0 -distort SRT 0 +repage ^
+duplicate -append +duplicate +append ^
( rose: -rotate 10 -geometry +50+50 ) -composite ^
out_2.png
: works when rose is not rotated
convert -size 250x150 xc:blue ^
-filter point -virtual-pixel tile -define distort:viewport=250x150+0+0 -distort SRT 0 +repage ^
( rose: -geometry +50+50 ) -composite ^
out_3.png
: works when background is not tiled
convert -size 250x150 xc:blue ^
( rose: -rotate 10 -geometry +50+50 ) -composite ^
out_4.png
ImageMagick 6.8.8-1 Q16 x64 on Windows 7
EDIT: Subject
SOLVED: -rotate and distort:viewport
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
SOLVED: -rotate and distort:viewport
Last edited by GreenKoopa on 2014-03-19T21:37:33-07:00, edited 1 time in total.
Re: placing an image on a tiled background
Add a background to your rotate:
But there could be other problems with the code causing the large box!
Code: Select all
convert -size 1x1 xc:blue ^
-filter point -virtual-pixel tile -define distort:viewport=250x150+0+0 -distort SRT 0 +repage ^
+duplicate -append +duplicate +append ^
( rose: -background transparent -rotate 10 -geometry +50+50 ) -composite ^
out_2.png
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: placing an image on a tiled background
Thanks Bonzo. Alternatively, a +define distort:viewport before rotating worked.
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: placing an image on a tiled background
I got it working!
output image
output image
Code: Select all
convert ^
-size 106x106 xc:rgb(246,245,229) ^
-stroke none ^
-fill rgb(68,94,109) -draw "circle 52.5,52.5 1,52.5" ^
-fill rgb(246,245,229) -draw "rectangle 0,43 105,62" ^
-write mpr:screw +delete ^
-size 95x1 xc:rgb(76,117,142) -size 10x1 xc:rgb(246,245,229) +append ^
-virtual-pixel tile -define distort:viewport=3770x2880+0+0 -distort SRT 0 +repage ^
-bordercolor rgb(76,117,142) -border 10x0 -bordercolor white -border 13x0 ^
-fill rgb(246,245,229) -draw "rectangle 373,700 3442,2879 ellipse 1907.5,899 600,600 199,341" ^
-fill rgb(76,117,142) -draw "rectangle 413,740 3402,2879 ellipse 1907.5,899 560,560 196,344" ^
-fill rgb(246,245,229) -draw "rectangle 433,760 3382,2879 ellipse 1907.5,899 540,540 195,345" ^
( +clone -flip ) -append ^
+define distort:viewport -virtual-pixel Edge -compose Over ^
( mpr:screw -distort SRT 20 -geometry +483+809 ) -composite ^
( mpr:screw -distort SRT 120 -geometry +3228+809 ) -composite ^
( mpr:screw -distort SRT 60 -geometry +483+4844 ) -composite ^
( mpr:screw -distort SRT 160 -geometry +3228+4844 ) -composite ^
-quality 90 PNG24:out.png
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: placing an image on a tiled background
In conclusion, I didn't realize that -rotate used the distort:viewport setting. Handy to know.
convert -define distort:viewport=100x80-10-10 rose: -rotate 10 out_5.png
convert -define distort:viewport=100x80-10-10 rose: -rotate 10 out_5.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: placing an image on a tiled background
That is new to me. Perhaps -rotate angle is now an alias for -distort SRT angle?GreenKoopa wrote:In conclusion, I didn't realize that -rotate used the distort:viewport setting. Handy to know.
convert -define distort:viewport=100x80-10-10 rose: -rotate 10 out_5.png