Preserving Image Metadata in Go
I’ve been digging into the world of image parsing the last couple days, after fixing image orientation issues while introducing a new issue: image metadata (particularly for color correction) getting lost during processing.
In short, Go’s standard
image/jpeg library tosses out metadata when you decode an image to transform it, as we do for images uploaded to Snap.as. So preserving that metadata means first parsing it out, running the transformations, then writing it back to the image when you encode it with the new transformations. Should be straightforward, right? Oh let’s see…