Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: image: add image.NYCbCrA and color.NYCbCrA types. #12722

Closed
nigeltao opened this issue Sep 23, 2015 · 5 comments
Closed

proposal: image: add image.NYCbCrA and color.NYCbCrA types. #12722

nigeltao opened this issue Sep 23, 2015 · 5 comments

Comments

@nigeltao
Copy link
Contributor

This adds transparency (an Alpha channel) to the existing YCbCr types for JPEG-like images and color. The N stands for non-alpha-premultiplied, the same as the existing NRGBA types.

JPEG-like-with-alpha is used by the WebP format, and there already exists code (see [0]) under golang.org/x to represent such images and colors. The proposal is to move that from golang.org/x/image/webp/nycbcra to image, so that the image/draw package in the standard library can recognize such images, and implement a fast path for drawing them, the way YCbCr images are fast-pathed.

[0] https://go.googlesource.com/image/+/master/webp/nycbcra/nycbcra.go

@minux minux added the Proposal label Sep 23, 2015
@bradfitz
Copy link
Contributor

SGTM. I don't think its inclusion would materially affect the display of https://golang.org/pkg/image/

@robpike
Copy link
Contributor

robpike commented Sep 23, 2015

SGTM

@adg adg added Proposal and removed Proposal labels Sep 25, 2015
@gopherbot
Copy link

CL https://golang.org/cl/15671 mentions this issue.

@pierrre
Copy link

pierrre commented Dec 20, 2015

@nigeltao I have a question about this change:

In YCbCr.RGBA(), the code is a modified copy of YCbCrToRGB():

    // This code is a copy of the YCbCrToRGB function above, except that it
    // returns values in the range [0, 0xffff] instead of [0, 0xff]. There is a
    // subtle difference between doing this and having YCbCr satisfy the Color
    // interface by first converting to an RGBA. The latter loses some
    // information by going to and from 8 bits per channel.

But in NYCbCrA.RGBA(), YCbCrToRGB() is called, instead of a modified version.
Why don't we use the same code?
I think we lose some information here.

@nigeltao
Copy link
Contributor Author

This question is now issue #13706.

@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants