Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Image size too ambiguous #1171

Closed
ifohancroft opened this issue Jan 17, 2019 · 4 comments
Closed

Image size too ambiguous #1171

ifohancroft opened this issue Jan 17, 2019 · 4 comments

Comments

@ifohancroft
Copy link

ifohancroft commented Jan 17, 2019

Hello,

I am in-love with neofetch and I have just found out that I can show an image instead of ASCII art and I think that this feature is awesome! I am failing to understand couple of things regarding the size of the images though.

Please consider this a feature request towards the wiki (as in, I am requesting/suggesting that information answering the following questions should be added to the wiki to either the frequently asked questions or to the 'images in the terminal' section).

What size is the crop?
Executing neofetch --w3m /path/to/image.extension I see a 478px image show, however if I have my terminal smaller, I will see a smaller image, thus this can't be trusted to find out what size of a square will be cut from the image.
Does the size depend on the image backend instead of on neofetch?

Does the --size / --image_size options set the size of the crop to be made or the size of the image to be shown as or both?

What happens if we provide a rectangular image that's smaller than the crop size?
*Will it show as it is or as a square? - If so, what size will be the square and how will it be termined? Will the smaller side get stretched to be as big as the bigger side or will the bigger side get squished (or maybe cut? how?) to match the size of the smaller side? Will always one specific side (the width? the height?) get stretched or squished or cut?

P.S. I am asking those questions as I am trying to understand how it works so I know what size to make the image I want to show so it can always be a bit taller than the output of neofetch (no mather the size of the terminal). I can always ask this directly but later I may decide I want it the same height as the output. I think I always want a square image but at some point I may decide I want a rectangular one.

@dylanaraps
Copy link
Owner

The image is cropped according to the value of crop_offset in your config file (defaults to center). The image size is half of the terminal width by default (ignoring gap, xoffset and yoffset).

The --size/--image_size flags (they're the same) set the size of the displayed image after the crop. If the image is smaller than the defined sizing (or half the terminal width id default) it it scaled up to the correct size.

You can use the --image_size none to disable the square cropping and square display of the image. This also works for vertical images and they're displayed in their full dimensions as well.

2019-01-21-075236_1570x970_scrot

You may be interested in this PR from late 2017 (#880). This PR simplifies image handling so it keeps aspect ratio of images by default but keeps sizing reactive to terminal size.

You can also use the flag --size XXXX to size the image in exact pixels though it will be limited to a square. The above PR looks like the best approach and if there's an interest from you or others, I'll rewrite it for the latest version of Neofetch. There wasn't an interest when I first opened the PR after all.

@ifohancroft
Copy link
Author

ifohancroft commented Jan 21, 2019

Thank you very much! Also yes, I do find an interest in having the PR #880 as part of the latest version of Neofetch.

P.S. Is the terminal width that's taken into consideration counted as pixels?

@dylanaraps
Copy link
Owner

Yes. Terminal width as pixels as well as terminal width as columns for the text positioning.

@dylanaraps
Copy link
Owner

#1392

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

No branches or pull requests

2 participants