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

feat: use gray instead of black values for transparent parts of image when returning as JPEG #412

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

subotic
Copy link
Contributor

@subotic subotic commented Mar 5, 2024

Problem Statement

When returning JPEGs for images that originally had a transparent background and the content was black, the returned JPEG would have black pixels instead of the transparent background as JPEG does not support transparency.

Desired Outcome

Return middle gray instead of the black for transparent parts of the image.

Solution

When a JPEG is requested, where the original image has an alpha channel defined, use the alpha channel information to force black pixels (0) to middle gray (128).

Copy link

linear bot commented Mar 5, 2024

@subotic subotic marked this pull request as ready for review March 5, 2024 13:55
@subotic subotic self-assigned this Mar 5, 2024
@subotic subotic requested review from siers and BalduinLandolt March 5, 2024 14:00
src/formats/SipiIOJpeg.cpp Show resolved Hide resolved
include/SipiImage.h Show resolved Hide resolved
src/SipiImage.cpp Outdated Show resolved Hide resolved
include/SipiImage.h Show resolved Hide resolved
src/SipiImage.cpp Show resolved Hide resolved
src/SipiImage.cpp Show resolved Hide resolved
@subotic
Copy link
Contributor Author

subotic commented Mar 6, 2024

@siers and @BalduinLandolt thanks for the review.

@subotic subotic changed the title feat: gray values for transparent parts of image when returning a JPEG feat: use gray instead of black values for transparent parts of image when returning as JPEG Mar 6, 2024
@subotic subotic merged commit f18dcfc into main Mar 6, 2024
5 checks passed
@subotic subotic deleted the feature/dev-3269-support-transparent-still-images branch March 6, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants