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

Corrected drawing I;16 points and writing I;16 text #7257

Merged
merged 2 commits into from Oct 5, 2023

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Jul 4, 2023

Resolves #7245

As the issue explains,

point8(Imaging im, int x, int y, int ink) {
if (x >= 0 && x < im->xsize && y >= 0 && y < im->ysize) {
if (strncmp(im->mode, "I;16", 4) == 0) {
im->image8[y][x * 2] = (UINT8)ink;
im->image8[y][x * 2 + 1] = (UINT8)ink;
} else {
im->image8[y][x] = (UINT8)ink;
}

is just drawing the writing the same value to two different points in our 8-bit image, whereas the point of 16-bit images is that each of those 2 8-bit values should be different.

This fixes that. It also means that the test from #3899 is slightly changed. The important part of that test was the width of the rectangle, which is maintained here.

The issue also requested a similar change for writing text, so I've added that commit for that.

@radarhere radarhere changed the title Corrected drawing I;16 points Corrected drawing I;16 points and writing I;16 text Jul 7, 2023
@radarhere radarhere added the Bug Any unexpected behavior, until confirmed feature. label Aug 1, 2023
@hugovk hugovk merged commit 6f73691 into python-pillow:main Oct 5, 2023
55 checks passed
@radarhere radarhere deleted the i16_point branch October 5, 2023 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Any unexpected behavior, until confirmed feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageDraw only uses lower 8-bits of colors in I;16 images
3 participants