Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexagon example does not work as expected #10

Open
pgajdos opened this issue Jan 15, 2025 · 2 comments
Open

hexagon example does not work as expected #10

pgajdos opened this issue Jan 15, 2025 · 2 comments

Comments

@pgajdos
Copy link

pgajdos commented Jan 15, 2025

An example taken from https://usage.imagemagick.org/canvas/

magick -size 24x24 xc: -draw "rectangle 3,11 20,12" tile_line.gif
magick tile_line.gif -gravity center \( +clone -rotate 0 -crop 24x18+0+0 -write mpr:r1 +delete \) \( +clone -rotate 120 -crop 24x18+0+0 -write mpr:r2 +delete \) -rotate -120 -crop 24x18+0+0 -write mpr:r3 +repage -extent 72x36 -page +0+0 mpr:r3 -page +24+0 mpr:r1 -page +48+0 mpr:r2 -page -12+18 mpr:r1 -page +12+18 mpr:r2 -page +36+18 mpr:r3 -page +60+18 mpr:r1 -flatten tile_hex_lines.jpg
magick -size 120x120 tile:tile_hex_lines.jpg tiled_hex_lines.jpg

produces:
tile_line

tile_hex_lines

tiled_hex_lines

Tested with 7.1.1-43.

@pgajdos
Copy link
Author

pgajdos commented Jan 15, 2025

Using magick convert instead of magick produces a bit better result:

tile_line

tile_hex_lines

tiled_hex_lines

@fmw42
Copy link

fmw42 commented Jan 18, 2025

In IM 7, the use of -page needs to be enclosed in parentheses

magick -size 24x24 xc: -draw "rectangle 3,11 20,12"  tile_line.gif

magick tile_line.gif   -gravity center \
          \( +clone -rotate    0 -crop 24x18+0+0  -write mpr:r1 +delete \) \
          \( +clone -rotate  120 -crop 24x18+0+0  -write mpr:r2 +delete \) \
                    -rotate -120 -crop 24x18+0+0  -write mpr:r3 +repage \
                    -extent 72x36 \( -page  +0+0  mpr:r3 \) \
          \( -page +24+0  mpr:r1 \)      \( -page +48+0  mpr:r2 \) \
          \( -page -12+18 mpr:r1 \)      \( -page +12+18 mpr:r2 \) \
          \( -page +36+18 mpr:r3 \)      \( -page +60+18 mpr:r1 \) \
          -flatten tile_hex_lines.jpg

magick -size 120x120  tile:tile_hex_lines.jpg  tiled_hex_lines.jpg

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants