Alpha scaling seems to behave weirdly #24

Open
opened 2024-06-20 00:56:49 -07:00 by NRK · 5 comments

To reproduce, open the attached image (I can't seem to attach pam files, so just posted the cli commands to recreate the image instead) with nsxiv -z 800 {img.pam} and notice that there's a red outline at the top, even though the red pixels have an alpha of 0.

$ cat > /tmp/pam.pam << EOF
P7
WIDTH 8
HEIGHT 2
DEPTH 4
MAXVAL 255
TUPLTYPE RGB_ALPHA
ENDHDR
EOF
$ for ((i=0; i<8;++i)); do printf "\xFF\x00\x00\x00" >> /tmp/pam.pam; done
$ for ((i=0; i<8;++i)); do printf "\x00\xFF\x00\xFF" >> /tmp/pam.pam; done
$ nsxiv -z 800 /tmp/pam.pam
To reproduce, ~~open the attached image~~ (I can't seem to attach `pam` files, so just posted the cli commands to recreate the image instead) with `nsxiv -z 800 {img.pam}` and notice that there's a red outline at the top, even though the red pixels have an alpha of 0. ```console $ cat > /tmp/pam.pam << EOF P7 WIDTH 8 HEIGHT 2 DEPTH 4 MAXVAL 255 TUPLTYPE RGB_ALPHA ENDHDR EOF $ for ((i=0; i<8;++i)); do printf "\xFF\x00\x00\x00" >> /tmp/pam.pam; done $ for ((i=0; i<8;++i)); do printf "\x00\xFF\x00\xFF" >> /tmp/pam.pam; done $ nsxiv -z 800 /tmp/pam.pam ```
Author

Actually, the problem seems like it's coming from anti-aliasing, not scaling. If I toggle anti-aliasing with a then the redish blur goes away.

Actually, the problem seems like it's coming from anti-aliasing, not scaling. If I toggle anti-aliasing with <kbd>a</kbd> then the redish blur goes away.
Owner

Hmm.. I'm not quite sure precisely what to expect, but the behavior seems fine to me.

Hmm.. I'm not quite sure precisely what to expect, but the behavior seems fine to me.
Author

I would expect the red color not to show up since it has an alpha of 0. I attached a png version of the test image. If I open it in firefox or mpv, there's no red anywhere.

I would expect the red color not to show up since it has an alpha of 0. I attached a png version of the test image. If I open it in firefox or mpv, there's no red anywhere.
Owner

I wonder if we are seeing the same thing.
I have attached screenshots of
$ nsxiv -z 800 pam.pam
and
$ imlib2_view -s 200 pam.pam
nsxiv and imlib2 both from current master.

The nxsiv image is rather small, and I find it hard to see much detail (or red blur).
The imlib2 image seems good to me. I see no reddish blur (but I do have minor problems with dark reddish nuances :) )

Could this be about which background the (transparent) scaled image is blended onto?
I tried changing imlib2_view's usual checkerboard background to pure white, and I still don't think I get reddish blur.

I wonder if we are seeing the same thing. I have attached screenshots of $ nsxiv -z 800 pam.pam and $ imlib2_view -s 200 pam.pam nsxiv and imlib2 both from current master. The nxsiv image is rather small, and I find it hard to see much detail (or red blur). The imlib2 image seems good to me. I see no reddish blur (but I do have minor problems with dark reddish nuances :) ) Could this be about which background the (transparent) scaled image is blended onto? I tried changing imlib2_view's usual checkerboard background to pure white, and I still don't think I get reddish blur.
Author

On my end, this is what I'm seeing with nsxiv -z 1600 (I increased the zoom limit in config.h):

image

With imlib2_view -s 200 I see this, which looks about right:

image

I suppose it could be an issue with nsxiv. I'll investigate this further and report back.

On my end, this is what I'm seeing with `nsxiv -z 1600` (I increased the zoom limit in `config.h`): ![image](/attachments/28e1c586-d9f0-43c0-913a-4696c939bf00) With `imlib2_view -s 200` I see this, which looks about right: ![image](/attachments/3ca0ae15-ee19-4b1c-8c2a-0ca5abeef9af) I suppose it could be an issue with nsxiv. I'll investigate this further and report back.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: old/legacy-imlib2#24
No description provided.