probablycorey/mini_magick — Issue #59: Create a new image from scratch
Author: v0n
Created: 2011-11-30 19:19:52+00:00
State: open

Hi,

If I'm not mistaken, it is not possible to create a new image (which doesn't exist on the disk yet) with MiniMagick, while it is possible with the `convert` tool. It would be useful, especially for canvas and composite. Here's a dirty hack I'm using:

def new_image(width, height, format = "png", bgcolor = "transparent")
tmp = Tempfile.new(%W[mini_magick_ .#{format}])
`convert -size #{width}x#{height} xc:#{bgcolor} #{tmp.path}`
MiniMagick::Image.new(tmp.path, tmp)
end

It would be interesting to add this feature in MiniMagick unless something similar already exists.

Best,
Vivien.