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

images occasionally too large for visible area #3

Open
steven-omaha opened this issue Feb 25, 2022 · 3 comments
Open

images occasionally too large for visible area #3

steven-omaha opened this issue Feb 25, 2022 · 3 comments

Comments

@steven-omaha
Copy link

I'm using i3-gaps as my (tiling) WM. This makes my terminals to be whatever size is available. For most sizes the images are scaled down correctly, so that they are visible entirely. Some terminal sizes cause the image to be too large for the available space.

I would expect the images to be scaled down so that one image always fits in the available space. But the printed image gets larger the smaller the terminal is.

My screen resolution is 2560x1440.

Original image:
cat_snow_eyes_fluffy_95615_1920x1200

1 terminal: (254 columns x 60 rows) good!
1

2 terminals side-by-side (126 x 60) good!
2

3 terminals: dividing one of the terminals vertically (126 x 30) not good!
3

4 terminals: dividing the last terminal again (126 x 14) not good!
4

@hackerb9
Copy link
Owner

hackerb9 commented Feb 26, 2022

That's very peculiar. The are two ways I could imagine that happening:

  1. The terminal program is not correctly updating its resolution. It is supposed to send SIGWINCH when a window changes size.
    or
  2. previewlines has been set to a size larger than the number of actual lines in the terminal.

It looks like number two may be the case. Did you set previewlines=20 at line 101? If so, try changing it back to 8. If you want full screen instead of a fast preview by default, instead change line 100 so it says viewmode="hq". Alternately, hit the vkey to view a preview as a full image.

The image is supposed to resize automatically in the full image (higher quality) view. I haven't implemented that for previews as I didn't think it was needed.

If you didn't change the number of preview lines then I am very confused. Why is the image so large? Vv was specifically designed so that, no matter what your screen resolution or font size, you'll get a reasonable image preview because its size is relative to the character cell height. It should be as high as 8 lines


By the way, what are the weird downward chevrons on the left side of the image? Is that alacritty's way of indicating that an image is clickable?

@steven-omaha
Copy link
Author

I'm using the current HEAD as-is, with all defaults. So I have previewlines=8.

If you want full screen instead of a fast preview by default

I'm only using the preview method right now, which suffices for me.

By the way, what are the weird downward chevrons on the left side of the image?

I have no idea. Image is definitely not clickable. I assumed that was just what vv would output.

@steven-omaha
Copy link
Author

By the way, I can reduce the preview size manually by pressing - a couple of times, which scales it down correctly.

Is it possible that calculating the scaling factor is bugged for certain terminal aspect ratios or small terminal sizes? Are you able to reproduce the error on your machine?

I just found the debug switch in the code. Here's the debug output for one image. (Geometry like in example no. 3 in the original post)

vv: notice: Please install w3m and w3m-img for reverse image search
window size is 4096 x 4096
font height is 146
usable screen height is 3796
preview height = fontheight × preview lines = 146 × 8 = 1168
preview size is 4096x1168 pixels
breadth
cat_snow_eyes_fluffy_95615_1920x1200.jpg	 1920x1200 8-bit sRGB
OSC 8 URI link goes to file://sumatrae/home/timeshifter/Bilder/wallpaper/old/cat_snow_eyes_fluffy_95615_1920x1200.jpg

If the window size is in pixel, that is definitely not correct.

And this is the debug output for the geometry of example 1.

vv: notice: Please install w3m and w3m-img for reverse image search
window size is 4096 x 4096
font height is 68
usable screen height is 3944
preview height = fontheight × preview lines = 68 × 8 = 544
preview size is 4096x544 pixels
breadth
cat_snow_eyes_fluffy_95615_1920x1200.jpg	 1920x1200 8-bit sRGB
OSC 8 URI link goes to file://sumatrae/home/timeshifter/Bilder/wallpaper/old/cat_snow_eyes_fluffy_95615_1920x1200.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants