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

Don't decode grayscale PNGs to RGB #3266

Open
mbrubeck opened this issue Sep 10, 2014 · 2 comments
Open

Don't decode grayscale PNGs to RGB #3266

mbrubeck opened this issue Sep 10, 2014 · 2 comments

Comments

@mbrubeck
Copy link
Contributor

@mbrubeck mbrubeck commented Sep 10, 2014

servo/rust-png#45 makes our PNG library always decode to RGBA format in memory, because our graphics code (azure) doesn't work with grayscale sources. We could save memory for grayscale images by adding support for grayscale in-memory representations.

@atouchet
Copy link
Contributor

@atouchet atouchet commented May 2, 2020

Servo no longer uses Azure. Is this still an issue?

@jdm
Copy link
Member

@jdm jdm commented May 2, 2020

According to

Ok(_) => match piston_image::load_from_memory(buffer) {
Ok(image) => {
let mut rgba = match image {
DynamicImage::ImageRgba8(rgba) => rgba,
image => image.to_rgba(),
};
pixels::rgba8_byte_swap_colors_inplace(&mut *rgba);
Some(Image {
width: rgba.width(),
height: rgba.height(),
format: PixelFormat::BGRA8,
bytes: IpcSharedMemory::from_bytes(&*rgba),
id: None,
cors_status,
})
it appears yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.