1
votes

I'd like to slit image into hexagon tiles. Means, crop original image to multiple hexagons.

I've found out how to split image to tiles:

convert -crop 8x8@ +repage +adjoin to_test.jpg asset_4x3@_%d.jpg

Which brings me almost quadratic images of my original one.

And I've tried using this script which can put hexagon grid on my image. With this parameters: -k hexagon -b 150 -t 1

But I can't figure out how to unite this scripts.

The first solution doesn't fully satisfies me, because I can resize each of the output images to hexagon, but I'll lose small parts of each image on convert quadratic to hexagon.
The second solution just place hexagon grid on original image, but doesn't crop every tile to other file.

So, my question is, how to split (crop) image to hexagon tiles?

1
My script, stainedglass, creates a temporary file with all the hexagons to cover the image. That script could be modified to save the hexagons file. Alternately, my script, bokeh, can be used to create a hexagon mask images as discussed by @bonzo below. You can then create the mask image and shift it over the background image to create tiles making the background of the tiles transparent. If you want more information, contact me offline. My email address is on my scripts web page at fmwconcepts.com/imagemagick/index.htmlfmw42

1 Answers

0
votes

I would create a hexagon mask. Then a script to loop over the image creating the hexagon tiles and saving them. This would be a complicated script ( for me ) to create but once done if you use variables could be run on any image. I do not think Imagemagick has anything built in to do it.

There is an example here that may put you on the right track: http://www.imagemagick.org/Usage/advanced/#jigsaw