You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I was attempting to create and edit png images on the fly with magick, but I found that neither the magick.new or the magick.new_image function existed.
Would you like me to take a crack at adding them in a PR? I am not familiar with moon or the busted system.
For anyone looking for a really poor performance workaround using os.execute and imagemagick's convert, you can use this:
__tmp = '/tmp/pico2png.temp.png'
function new_image(w,h)
os.execute('convert -size '..w.."x"..h..' xc:white '..__tmp)
local png,err = magick.load_image(__tmp)
return png,err
end
__points = {}
__count = 0
function set_pixel(x,y,r,g,b)
table.insert(__points,"fill rgb("..r..","..g..","..b..") point "..x..","..y.." ")
if __count > 2^12 then
__flush_pixels()
__count = 0
end
__count = __count + 1
end
function __flush_pixels()
os.execute("convert -draw '"..table.concat(__points).."' "..__tmp.." "..__tmp)
__points = {}
end
-- run this before reading information about your image object.
function __post()
__flush_pixels()
return magick.load_image(__tmp)
end
The text was updated successfully, but these errors were encountered:
magick currently doesn't have any drawing functions, so making a new image isn't that useful. I'm not opposed to adding those kinds of functions though.
This library is an FFI binding to ImageMagick. We can easily introduce any function implemented by ImageMagick's C interface. Here are a bunch: http://www.imagemagick.org/api/magick-image.php
So I was attempting to create and edit png images on the fly with magick, but I found that neither the
magick.new
or themagick.new_image
function existed.Would you like me to take a crack at adding them in a PR? I am not familiar with moon or the busted system.
For anyone looking for a really poor performance workaround using
os.execute
and imagemagick'sconvert
, you can use this:The text was updated successfully, but these errors were encountered: