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

Improve "convert to PIL" example #250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucach
Copy link
Contributor

@lucach lucach commented Jun 1, 2024

The default color type of a skia.Image is platform dependent. On some systems (e.g., GitHub CI, and most Linux systems) the default color type is BGR (for endianness purposes).

See https://github.com/google/skia/blob/6ffe89f9b4cc8c1dae9c4a916f16f9c463e3fa6d/include/core/SkColorType.h#L58-L62

Thus, in general, not only one has to convert the alphaType to create a PIL image, but also the colorType.

The default color type of a `skia.Image` is platform dependent. On some systems (e.g., GitHub CI, and most Linux systems) the default color type is BGR (for endianness purposes).

See https://github.com/google/skia/blob/6ffe89f9b4cc8c1dae9c4a916f16f9c463e3fa6d/include/core/SkColorType.h#L58-L62

Thus, in general, not only one has to convert the `alphaType` to create a PIL image, but also the `colorType`.
@HinTak
Copy link
Collaborator

HinTak commented Jun 1, 2024

I am wondering if it is possible to detect what skia's image color type is (such as a class static method), and also adds a few more tests to the pytests.

@HinTak
Copy link
Collaborator

HinTak commented Jun 14, 2024

Oh, we do expose the kN32... type directly:

.value("kN32_ColorType", SkColorType::kN32_SkColorType)
so it is possible to test if it is equal to either of the two, to detect endian.

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.

None yet

2 participants