I need a little hint. I'm creating thumbnails of images in Go and would like to pass them to jpegoptim for crushing.
jpegoptim has the --stdin and --stdout flags, which I would like to use. Now, I don't want to save the generated image to disk first, but convert my *image.RGBA to something that implements io.Reader, so I can pass it to exec.Cmd.Stdin
I'm a little lost on how I could achieve this, would be great if someone can point me in the right direction.
Thanks
In this case, you don't need to implement your own
io.Reader
. Useio.Pipe
andjpeg.Encode
, e.g.