Go's image.Image
interface has three methods: Bounds
(clearly necessary for determining the size of an image), At
(which returns the actual color at each pixel), and ColorModel
. This last method returns a color.Model
, which is capable of converting a color from any model into the representation that this image uses.
Why is ColorModel
a part of this interface? How is it used by consumers of the image.Image
type? If I have an image img
, and I know nothing about its underlying representation, what good does img.ColorModel()
do me? I can convert any color into the proper model, but I don't see what I can use this converted color for; the other two ways of interacting with an image, At
and Bounds
, do not take colors as arguments.
Am I missing something? Do any standard library functions call the ColorModel
method of an image.Image
, and what for?