libsixel icon indicating copy to clipboard operation
libsixel copied to clipboard

png2sixel does not work for small png files (~140x165)

Open MiroPalmu opened this issue 1 year ago • 4 comments

On arch linux with foot version: 1.18.1 +pgo +ime +graphemes -assertions

img2sixel 1.10.3

configured with:
  libcurl: yes
  libpng: no
  libjpeg: no
  gdk-pixbuf2: yes
  GD: no

does not display small png files.

I have three test files with sizes 125x165 (a.png), 138x165 (b.png) and 138x140 (c.png). From these only b.png works. See screenshot below.

image

MiroPalmu avatar Oct 05 '24 09:10 MiroPalmu

See https://github.com/saitoha/libsixel/issues/154.

t-bltg avatar Oct 31 '24 12:10 t-bltg

@MiroPalmu I tried reproducing the issue using a small 8-bit sRGB PNG from the repository’s test data, but was unable to. Would you be able to provide the image that causes the problem? Image

saitoha avatar Aug 03 '25 05:08 saitoha

Unfortunately I don't have those anymore.

Here is the same command on foot version: 1.22.3 +pgo +ime +graphemes -assertions:

Image

I also tried all the images from the repo and it seems that only one works:

Image

However, if I set font size to be large enough with ctrl-+ even that image stops working (I increased the font size between every img2sixel call):

Image

MiroPalmu avatar Aug 03 '25 08:08 MiroPalmu

@MiroPalmu When a terminal renders a sixel image, the final cursor position should end up on top of the last row of the image (not all terminals work the same way, but that's basically what's supposed to happen). So if the image you're viewing is less than the height of a single row, your shell's prompt can end up overwriting it completely, and it will appear as if nothing has been rendered.

If that's what happening here, you can try forcing a line break after the image to prevent the prompt overwriting it. So something like this:

img2sixel filename.png; echo

j4james avatar Aug 03 '25 09:08 j4james