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

nip2 displays wrong values for uint image, instead displaying values interpreted as int #74

Closed
erdmann opened this issue Nov 13, 2018 · 2 comments
Labels

Comments

@erdmann
Copy link

erdmann commented Nov 13, 2018

Hi John,

I have a vips format (.v) single-band file that's full of '0xFFFFFFFF' values, i.e., 2**32 - 1 = 4294967295. The band format is 'uint', and both libvips and nip2 correctly report this. Values reported in cells, such as max(A1), are also correct.

The bug is in the image viewer, which is apparently incorrectly interpreting these values as 32-bit signed 'int' values, i.e., as -1 since (int)0xFFFFFFFF == -1. This problem appears both in the numerical display of the pixel values under the mouse cursor as well as in the display of the brightness since all such pixels appear as black. In other words, it's apparently not just a problem with "%u" instead of "%d" in a sprintf statement somewhere. The thumbnail is also incorrectly showing the image as black instead of white.

Many thanks in advance.

@jcupitt
Copy link
Member

jcupitt commented Nov 13, 2018

Yes, I see this too. I'll have a look. Thanks for the report!

jcupitt added a commit that referenced this issue Nov 13, 2018
would display -ve values for pixels > 2**31

see #74
@jcupitt jcupitt added the bug label Nov 13, 2018
jcupitt added a commit to libvips/libvips that referenced this issue Nov 14, 2018
we could get sign and overflow mixed up for casts on uint images

see libvips/nip2#74
@jcupitt
Copy link
Member

jcupitt commented Nov 14, 2018

There was a libvips bug too, ouch. Fixed in git master, thanks!

@jcupitt jcupitt closed this as completed Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants