-
Notifications
You must be signed in to change notification settings - Fork 64
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
yoffset
option for images like w3m?
#164
Comments
Hi, thanks for bringing it up. I need a little more information, so I can figure out if/how this idea could apply more generally.
It would be great to have a screenshot of how it looks in Neofetch. Is the problem actually that it's misaligned there, or is it important to have the spacing when you run |
Thanks, that explains the request perfectly. The good news is that The bad news is that chafa --stretch --size="$((width / font_width))x$((height / font_height))" "$image" There's no positioning information there, so it would be necessary to patch Neofetch to pass it on to Chafa. And unfortunately, its developer seems to be on hiatus still. Might be possible to get traction for it in one of the forks, though. |
I just released version 1.14.0. It has the new options You can add a one-line vertical offset like this:
Unfortunately there's nothing I can do about Neofetch directly. Hope it's useful anyway! |
Pixel adjustments are possible with the new smolscale - we could even support cropping if the image is partially outside the viewport, or adjustments in 1/256 fractional pixel increments (but then it'd get blurrier). I'll have a think about how this could fit with the existing options. We're actually already doing pixel offsets when the image is slightly smaller than the view -- but you can't control the offsets precisely. I.e. |
I'm adding some text beside and below the image, something like the text wrapping around the image. So pixel offsets would be more useful than the align option in such cases. |
If I may chime in... @quincynyan I'm curious, why would column/row offsets not be okay (or even better)? |
@AnonymouX47 I can already kinda implement that behavior bu moving the cursor to wherever I want on the terminal scree and the running chafa. For example, The feature I want is something similar to w3mimgdisplay or kitty where you can run This moves the image by specific pixels from the current cursor position. |
I guess I should rephrase my question... Why aren't row and column offsets sufficient? Or Why do you need exact pixel offsets? Side note: Using CUP ( |
@quincynyan Does it have to be absolute offsets? Would it be enough if the current |
@AnonymouX47 Sorry I'm late, I've been busy with something for the past couple of days. I'm making a bash script CLI app which allows the user to position where their image will be displayed (and also choose which display backend they want to use). This is through the |
@hpjansson I already know the widths and heights of the image, and so maybe what I can do is create an empty space/canvas of (width+xoffset) x (height+yoffset), then |
Hmm... I see. |
Again, it's not a requirement, it's just a feature request. If not possible, I'll try to reverse engineer how w3m does it and maybe port it to my app. The problem is I don't really know C language so it's hard reading the source code lmao |
One important thing to note is, only the Kitty graphics protocol supports pixel offsets for image placements. For the record, Anyways, like @hpjansson mentioned, it's possible to mimick the behaviour... I would imagine by compositing the original image (after being appropriately scaled; not source image) onto the lower-right region of a transparent canvas of size The only issues I can think of at the moment are:
|
The reason I created this issue was to resolve this issue: https://cdn.nekonyan.fun/Peek_2023-09-09_10-22.gif I know the author is on hiatus and isn't currently accepting any pull requests, but I can fork my own version of it and fix it. Here is the code for
Here is the code for
Here is the code for
As hp mentioned, there is no information passed about offsets there. So how would the offsets information be passed on to chafa so that it renders the image correctly just like it does in w3m and kitty? I've implemented both w3m and kitty in my fork, but don't know how to implement chafa. Again, I'm measuring the offsets starting from the current position of the cursor after clearing the screen and moving the cursor to the top left. |
I am using chafa together with neofetch, but the image outputted is printed at the top of the terminal, i want it around 50 pixels moved down. This can be done with the
--yoffset 50
in w3m, but can't find something similar in chafa. Maybe like some sort of padding above the image? When I just runchafa image.png
, I want some space between the current line of the command (where i typed and entered the command) and the top of the image by some amount of pixels specified by me.The text was updated successfully, but these errors were encountered: