tiling trouble

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
imaggie
Posts: 88
Joined: 2011-12-19T04:15:36-07:00
Authentication code: 8675308

tiling trouble

Post by imaggie »

Hi,

I need to tile a new image with a repeated section of a base image. I can't seem to get the right syntax for any of the many ways to do tiling.

So far I can crop the bit I need and create an image with one copy but cannot tile it.

Code: Select all

convert  -size $((5*$wid))x$((5*$ht)) xc:black \
 tile.png  -crop 50%x25%+25%+5% \
 -compose Over -composite \
 tiled-tile.png
Could someone point me in the right direction?

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tiling trouble

Post by fmw42 »

I am not sure I understand what you are trying to do. Is it that you want to crop the tile.png image and then tile it out over the base black image? Please clarify. In the mean time, see http://www.imagemagick.org/Usage/compose/#tile and http://www.imagemagick.org/Usage/canvas/#tile_memory


try

convert tile.png -crop ... +repage -write mpr:tilepng +delete \
-size ... xc:black tile:mpr:tilepng \
-compose over -composite \
test.png


Also note that geometry offsets (in your -crop) will not be interpreted as %, but as raw coordinates even if you specify the percent sign. This is not the case for width or height, only +X+Y. See http://www.imagemagick.org/script/comma ... p#geometry
imaggie
Posts: 88
Joined: 2011-12-19T04:15:36-07:00
Authentication code: 8675308

Re: tiling trouble

Post by imaggie »

thanks again.

that's the second biggest problem with IM , the doc is about an anarchistic as the syntax. If found the "doc" for the tile option but it was so brief as to be useless.

http://www.imagemagick.org/script/comma ... .php?#tile

There has clearly been a huge amount of work gone into writing all this stuff but it seems you need to read the whole lot to get anywhere.

-tile links to composite which is so brief it is barely any help and then links back to -tile...

I usually find I have to start googling and sifting through various examples in the hope of _devining_ what the syntax definition of a particular command is.

I'm starting to get a feel for what xc can do but despite a huge amount of reading I have not seen definition nor do I have any idea what why it's called xc.

Finally I found a different way to do my tiling:

Code: Select all

convert \
  tile.png -crop  25%x25%+20%+20%  -write mpr:tile +delete  \
 \( -size $((5*$wid))x$((5*$ht)) tile:mpr:tile \) \
 tiled-tile.png
You'll probably now tell me that the percent only works on the 25 and not the offsets , right ? ;)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tiling trouble

Post by fmw42 »

xc I believe came from x color as many of the names of colors came from X11 colors or CSS colors.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tiling trouble

Post by fmw42 »

xc I believe came from x color as many of the names of colors came from X11 colors or CSS colors. You can also use canvas: in place of xc: on newer IM releases.
Post Reply