-
Notifications
You must be signed in to change notification settings - Fork 65
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
Distortion when rowstride is not a multiple of 4 #141
Comments
Hi! So, my first thought is that this could be caused by a bad rowstride parameter. I see you're using Second, you're passing in the pixels as premultiplied alpha, but I think it's more common for image loaders to give you unassociated alpha. I don't know the details of how the image was loaded, though. This probably doesn't matter unless your image is partially transparent. |
yeah, it's in your examples
I don't think so, this issue only happens with chafa, all the other output methods I support work fine. (x11, sixel, kitty, iterm2)
ah, I was just testing values to see if anything changed, doesn't work still with unassociated
I'm using libvips and opencv for image loading. The issue kinda depends on the terminal though, in alacritty it shows bad but on mate terminal it displays correctly that image. |
This helped when I tried it here:
|
If you have an example picture that shows discoloration, I'd be very interested to have a copy to test with. |
Managed to repro it with uberzeugpp and one of my test images just now. Figuring out what's going on. |
is there a way to discover which symbols are supported by a terminal at runtime?
thanks for the help |
There's no reliable way to discover symbol support that I know of, unfortunately. But blocks and borders are pretty reliable (i.e. works on all terminals I've tested, even Windows DOS/PowerShell and various MacOS ones). |
Fixed. Thanks for reporting this. It may take some time for fixed packages to make their way into updates on the various distros. If you're already pre-scaling the images, scale them to a multiple of 4 pixels wide if you want to work around this bug in the meantime. Sorry for the inconvenience.
Lines 1452 to 1462 in 3843ac7
Note the selection is more conservative on Windows due to historically more limited symbol support there. |
Are you making a new release with this fixes? Sadly can't test them since there's no
thanks for the example. |
Another option is to ensure it gets 4-channel data in, as the issue only affects 3-channel input where (width % 4 != 0). Stupid, but at least it's fixed now. I'll make a point release this weekend.
You're welcome. If there's anything else you need, don't hesitate to ask. |
hmm, that reduces performance but it works at least.
hmm, if I could ask you something, could you add a variant of
so it was chafa adding the padding all along... Thanks for the help. |
Sure, I can do that. It would be for the 1.14.0 feature release, which should happen in not too long. Do you prefer GStrings or would a strv work as well? I used GString before because then you don't need to call strlen() again. |
yeah, GString should be better, it's already hard enough managing c-strings (and in turn glib strings) in C++, if you can return how many items are in the array even better :) Edit: maybe return a struct? even easier wrapping that with smart pointers Edit2: I guess gchar** would be best, as glib already has g_strfreev |
Commit 803c3be adds the functions; both flavors :-) |
awesome, too bad |
I'm trying to implement chafa support on ueberzugpp but sometimes the images appear moved and/or discolored. Like this.
both moved and discolored
just moved
The borders are from lf.
The main code I'm using is this.
I've tested in multiple terminals and in all of them show some form of this issue, not necessarily on the same image.
The text was updated successfully, but these errors were encountered: