Hello 9fans,
For me, jpg(1) can't display most jpeg images I have. So I made a go
program that convert a jpeg image from stdin to a png image to stdout.
Assume that Plan 9's png is not broken ;)
To test, go to https://thuychi.vn/anh.html
Of 50 images, Plan 9's jpg could only decode 3. The go library can
decode all of them.
I hope that there will be go image/plan9 and a draw library that works
on Plan 9 too... Replace the jpg(1) programs with the Go version!
bind /bin/jpgtopng.rc /bin/jpg, I think at least abaco don't need to
be modified.
------------------------------------------
9fans: 9fans
Permalink:
https://9fans.topicbox.com/groups/9fans/T33c04c0193c96a35-Ma23395e098a06127a6808b3c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
package main
import (
"fmt"
"image/jpeg"
"image/png"
"os"
)
func main() {
img, err := jpeg.Decode(os.Stdin)
if err != nil {
fmt.Fprintf(os.Stderr, "decode: %v\n", err)
}
err = png.Encode(os.Stdout, img)
if err != nil {
fmt.Fprintf(os.Stderr, "encode: %v\n", err)
}
}#!/bin/rc
jpgtopng | png $*