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

@nigeltao nigeltao commented Sep 23, 2015

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

@bradfitz bradfitz commented Sep 23, 2015

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

Loading

@robpike
Copy link
Contributor

@robpike robpike commented Sep 23, 2015

SGTM

Loading

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

@gopherbot gopherbot commented Oct 10, 2015

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

Loading

@nigeltao nigeltao closed this in c478c48 Oct 11, 2015
@pierrre
Copy link

@pierrre 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.

Loading

@nigeltao
Copy link
Contributor Author

@nigeltao nigeltao commented Dec 23, 2015

This question is now issue #13706.

Loading

@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants