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

add display for multiple images horizontally #102

Open
acxz opened this issue Aug 13, 2022 · 6 comments
Open

add display for multiple images horizontally #102

acxz opened this issue Aug 13, 2022 · 6 comments
Assignees
Labels
feature New feature or request
Milestone

Comments

@acxz
Copy link

acxz commented Aug 13, 2022

Having the ability to display multiple images in a horizontal fashion.

Right now calling multiple images with chafa defaults to a vertical layout, but it would be nice to also have a horizontal layout.

For reference, timg achieves this with the --grid flag. https://github.com/hzeller/timg/blob/cfd5f7a99401074ccfad31fa6234e94e5175074f/README.md?plain=1#L82

P.S. as a workaround currently I am using imagemagick to manually stitch the images together and then using chafa. I imagine if this step is done inside of chafa, the overall pipeline will be faster.

@hpjansson
Copy link
Owner

Absolutely. It's not even that hard to add, so I could see it making the 1.14 release.

For reference, I imagine you're using something like this...

montage -tile 6x -background none -geometry 64x64+1+1 *.png - | chafa -s 80

...which is indeed very slow, and also consumes lots of memory if it's a big collection. With proper support in chafa, you could also show file names etc.

@hpjansson
Copy link
Owner

This reminds me I also want something like a --fit-width switch or some other way to respect one terminal dimension while ignoring the other (as you would with tall images that're supposed to scroll vertically).

@hpjansson hpjansson self-assigned this Aug 14, 2022
@acxz
Copy link
Author

acxz commented Aug 14, 2022

For images I am using +append:

https://github.com/acxz/pokeshell/blob/52b3ec29dfb9cb9e0c3a0ed4198d9c019536e84a/bin/pokeshell#L446-L447

However, for gifs I have to do something a bit more creative:
https://github.com/acxz/pokeshell/blob/52b3ec29dfb9cb9e0c3a0ed4198d9c019536e84a/bin/pokeshell#L524-L529

For gifs it is a bit more involved as I down/upsample the frames in multiple gifs to have the same number of frames in all the gifs. I essentially create a new gif stitched images that are sampled from the individual gifs.

The more this functionality can be incorporated into chafa the faster I believe my script will be.

@clort81
Copy link

clort81 commented Jan 20, 2023

to fit width i just alias or script -s $(tput cols)

@hpjansson hpjansson added the feature New feature or request label Jan 31, 2023
@wabiloo
Copy link

wabiloo commented Feb 24, 2024

Any feedback on how I could do this?
And ideally I'm after a method that would work with the various pixel types...

@hpjansson
Copy link
Owner

Hi - I didn't have time to add this in 1.14, but I'll see if we can't get something going for 1.16. --fit-width is in now, though. Thanks for the interest.

@hpjansson hpjansson added this to the 1.16 milestone Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants