Why image.YCbCr don't have a Set method?

507 views
Skip to first unread message

kawamoto

unread,
Jul 14, 2013, 6:09:59 AM7/14/13
to golan...@googlegroups.com
Hello

Why image.YCbCr don't have a Set method?

I'd like to change a single pixel of JPEG file, but I don't know how to do it.

I might not understand such details about JPEG...

Kawamoto

Larry Clapp

unread,
Jul 14, 2013, 11:14:27 AM7/14/13
to golan...@googlegroups.com
YCbCr isn't a pixel-addressable format. "There is one Y sample per pixel, but each Cb and Cr sample can span one or more pixels." -- http://golang.org/src/pkg/image/ycbcr.go?s=1514:1661#L36

http://golang.org/doc/articles/image_draw.html says

The result of decoding an image format might not be an image.RGBA: decoding a GIF results in an image.Paletted, decoding a JPEG results in aycbcr.YCbCr, and the result of decoding a PNG depends on the image data. To convert any image to an image.RGBA:

    b := src.Bounds()
    m := image.NewRGBA(b)
    draw.Draw(m, b, src, b.Min, draw.Src)
Hope that points you down the right track.

-- Larry

Yasutaka Kawamoto

unread,
Jul 20, 2013, 11:34:34 AM7/20/13
to Larry Clapp, golang-nuts
Thanks Larry.

2013/7/15 Larry Clapp <la...@theclapp.org>:
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages