imaarov / meme.js

Bring memes into your terminal
MIT License
58 stars 1 forks source link

Display of meme images #8

Closed imaarov closed 3 months ago

imaarov commented 4 months ago

the current quality of the images that are displayed in the terminal is not good if you have any ideas for displaying images in other ways or enhancing the quality of this implementation you can explain them here

1p22geo commented 4 months ago

Can we (by default) display the images using Firefox or another app? Does it have to display in terminal, or can it be just a CLI for displaying memes somewhere?

How about the app tries to open the meme using xdg-open, or just using your default program for JPG files, and if that fails, use terminal-image.

1p22geo commented 4 months ago

We can also use atanunq/viu but it only works with some terminals.

imaarov commented 4 months ago

Can we (by default) display the images using Firefox or another app? Does it have to display in terminal, or can it be just a CLI for displaying memes somewhere?

How about the app tries to open the meme using xdg-open, or just using your default program for JPG files, and if that fails, use terminal-image.

Hi thank you for your contribution, the main functionality until now in meme.js is that show the memes into the terminal (of course it is still in the beginning phase, and lots of other basic features are needed for that) your idea that it should cover another app to show the image is very good, and I will add this feature for meme.js surely but the terminal option for viewing should be in higher priority.

imaarov commented 4 months ago

We can also use atanunq/viu but it only works with some terminals.

Thanks for your recommendation, I will look it out but if I recall this depends on some specific terminal and some environment (I think it's for iterm only)

1p22geo commented 4 months ago

Most terminals don't support image viewing. And icat or the terminal-image library are displaying it in the best resolution the terminal allows for - one pixel per character.

Most people have a desktop environment, and opening an image viewer in an unfocused window (and closing it after the user presses enter or return, before opening another one) would be enough for most, in my opinion.

That being said, we can definitely write a NVIM or Emacs extension for that.

imaarov commented 4 months ago

Yes! As I said before I will add the image viewer option to show the image and the functionality that you provide is great for that and I appreciate it, I can't find the perfect package for that, maybe there isn't, or is not possible to make it better than icat or terminal-image so I move on to the other features (as you say showing in image viewer apps and others...) and this issue will be closed soon. but you can explain more about the nvim extension if you don't mind

1p22geo commented 4 months ago

Yes! As I said before I will add the image viewer option to show the image and the functionality that you provide is great for that and I appreciate it, I can't find the perfect package for that, maybe there isn't, or is not possible to make it better than icat or terminal-image so I move on to the other features (as you say showing in image viewer apps and others...) and this issue will be closed soon. but you can explain more about the nvim extension if you don't mind

You don't need a package for opening an image viewer, just run a terminal command. Here's how to run a basic command

const { exec } = require("child_process");

exec("ls -la", (error, stdout, stderr) => {
    if (error) {
        console.log(`error: ${error.message}`);
        return;
    }
    if (stderr) {
        console.log(`stderr: ${stderr}`);
        return;
    }
    console.log(`stdout: ${stdout}`);
});

And then basically you can execute something like firefox image.jpg to open it. No packages and dependencies required.

1p22geo commented 4 months ago

As for the nvim extension, I'm not really proficient in those, but that's usually Lua, not JS. I use nvim myself, and it propably has some kind of support for that.

1p22geo commented 4 months ago

There's image.nvim. It uses ImageMagick, so it might work cross-platform.

imaarov commented 4 months ago

Thank you for sharing it, I have to check these extensions, but the main thing will be adding the image viewer feature with Firefox as you said, or any other apps. thank you for your recommendation.

imaarov commented 3 months ago

I'm using kitty icat to show in kitty terminal for now the display of images is kind of solved (in kitty terminal). now we have to find out what we should do with other terminals