c++ - How do I convert an RGB byte[] slice to an image.Image in go? -
a c++ application running in process passes in char[] array of three-byte pixels (red, green, blue) go program. i've reconstructed in go byte[] slice using cgo, i'm unsure how convert image. can pass width or height well, if needed (i imagine be).
i'm aware of image.rgba type, documentation seems imply aren't single-byte-per-color, , assumes there alpha channel, simplistic bitmap not have. converting 3 byte values have works image.rgba solution? if so, how should that?
alternatively, conversion in c/c++ before sending values format go recognizes (jpeg, gif, png). either way works uses, don't know how approach either.
the image package based on interfaces. define new type those methods.
your type's colormodel return color.rgbamodel, bounds - rectangle's borders, , at - color @ (x, y) can compute if know image's dimensions.
Comments
Post a Comment