imagemagickdragonfly-gem

Tile an image x times to a y px output image in imagemagick


I am using ImageMagick (via Dragonfly in Ruby) and need to convert an image that looks like this:

X

To tile like this:

XXX XXX XXX

and have a set width (200 px in my case).

How would I accomplish this?


Solution

  • With ImageMagick, you would load the source image with the tile: format.

    convert -size 200x200 tile:x.png out.png
    

    For Dragonfly, you would need to extent the Dragonfly.app.generate

    image = Dragonfly.app.generate(:convert, '-size 200x200 tile:x.png', 'png')