magick
magick copied to clipboard
Comply with image.Image interface
This is more of a question than an issue: I wonder how hard it would be to make MagickImage
comply with the image.Image
interface in the image stdlib package?
The use case would be that I can use magick along with other image-handling packages. For example I just wrote an image resizing server using Resize and I would like to replace the image-handling parts of my code with magick so I can benchmark the two.
Looking at the image.Image interface definition it looks like you'd only have to implement the following:
type Image interface {
// ColorModel returns the Image's color model.
ColorModel() color.Model
// Bounds returns the domain for which At can return non-zero color.
// The bounds do not necessarily contain the point (0, 0).
Bounds() Rectangle
// At returns the color of the pixel at (x, y).
// At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid.
// At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.
At(x, y int) color.Color
}
:+1: for this