Thanks Matt. After your advice (and some reflection) - i decided to refactor all my code and keep the matrix in colour.Colour values rather than uint32's.
Am actually happier i did it, as it provides for more neater / more concise code with better readability. Interestingly though, when i do a colour swap (without any type casting happening now) - the colour problem is still there. In the images below, the letter "RGB" in their respective colours should have purely swapped colours - but as you can see from the image below, just reading and writing the same colours produces a visibly different hue on the red (which has become a pink on the letter G now). There was absolutely no manipulation of the values that happened, only a swapping... i guess i'll try to dig into the source for Decode/Reader function (i think that's where it's happening as when i write the image as a jpg/gif/png - they all have the colour issue). Image from: https://github.com/simran91/monkeysee/blob/master/samples/rgb.png <http://s.bl-1.com/h/1TJbp0y?url=https://github.com/simran91/monkeysee/blob/master/samples/rgb.png> [image: rgb.png] Image from: https://github.com/simran91/monkeysee/blob/master/samples/rgb-png-to-png-mod-SwapRGBtoGBR-autogenerated.png <http://s.bl-1.com/h/1TJbtP0?url=https://github.com/simran91/monkeysee/blob/master/samples/rgb-png-to-png-mod-SwapRGBtoGBR-autogenerated.png> [image: rgb-png-to-png-mod-SwapRGBtoGBR-autogenerated.png] thanks for your help though... have really appreciated it. cheers, simran. On Mon, Jul 4, 2016 at 12:26 PM, Matt Harden <matt.har...@gmail.com> wrote: > I think you're best off not taking the RGBA values and then building a > color from them. Just take the color you're given and use m.Set(x, y, c) on > the target image. If you need to modify the color, one way to do that would > be to create your own object that implements the color.Color interface (the > RGBA() method) and returns int32 values based on the source color's values. > For example swapping red & green. Maybe this example will help: > https://play.golang.org/p/vD1YBLR7nn > > On Sun, Jul 3, 2016 at 7:09 PM simran <simrangamb...@gmail.com> wrote: > >> Hi Dan, >> >> I get a "page not found" on all those four links... >> >> cheers, >> >> simran. >> >> On Mon, Jul 4, 2016 at 10:22 AM, Dan Kortschak < >> dan.kortsc...@adelaide.edu.au> wrote: >> >>> github.com/gonum/matrix/mat64 (soonish to be gonum.org/pkg/matrix/mat64) >>> is a general purpose matrix library. >>> >>> A more specific image maths package is available at >>> github.com/go-gl/mathgl/mgl{32,64} >>> <http://github.com/go-gl/mathgl/mgl%7B32,64%7D>. >>> >>> On Mon, 2016-07-04 at 10:07 +1000, simran wrote: >>> > Hi Dan, >>> > >>> > I am hoping to find a general matrix library as i want to write my own >>> > rotation, translation, reflection methods; however, if you do know a >>> > good >>> > image library doing these, i'd appreciate it as a reference anyway. >>> > >>> > cheers, >>> > >>> > simran. >>> >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.