hzeller / timg

A terminal image and video viewer.
GNU General Public License v2.0
1.92k stars 73 forks source link

Add this program to Termux #61

Closed bropines closed 3 years ago

bropines commented 3 years ago

Due to the absence of most of the dependencies, it is impossible to install this program. Please add Termux support.

hzeller commented 3 years ago

Can you find the maintainers of termux to find out what dependencies are hard to meet ? Maybe we can reduce some.

You can compile timg without video support, which is a lot of dependencies, and also various other things such as turbojpeg or openslide.

The next big dependency is graphicsmagic which can be big, but I would be open to make a super-small dependency of stb image in which would reduce dependencies a bit and would be good for small devices.

Ultimately, the termux maintainers would have to add it to their repository of installable packages, so it would be good to find a maintainer for for the packages to be added to this thread. For instance: would an application written in C++ even be possible to install, or would it need to be java ?

bropines commented 3 years ago

So. I was able to run a program in termux, but I had to disable support for open slide and turbojpeg. Everything works stably. As it turns out, critical dependencies are present in the Thermex repository. At the expense of stb image, it is greatly missed, since on my device, when the resolution is increased, the terminal simply crashes. And so I apologize for the panic. It works, but with poor optimization(I also checked different settings)

hzeller commented 3 years ago

ah, neat. Would you like to write up how to compile it so that it can be packed for termux ? Or are you upstreaming it to the termux package ?

I'll have a look to integrate stb image.

hzeller commented 3 years ago

Alright, added STB image support to help minimize external dependencies. The scaling is not always as good as with the sws_scale, and animated gifs don't work, but for the sake of less dependencies, this can be an acceptable trade-off.

Use these cmake flags:

-DWITH_VIDEO_DECODING=off -DWITH_OPENSLIDE_SUPPORT=off -DWITH_GRAPHICSMAGICK=off -DWITH_TURBOJPEG=off -DWITH_STB_IMAGE=on

bropines commented 3 years ago

The update is installed. Everything works a little faster, except for the buffer of the terminal itself, but this is already a question for the creator of Thermex. I do not know how to build packages for termix, but such information should be on their wiki. I installed it according to the instructions for debian, finding similar libraries and packages. Here is the link to the wiki: https://wiki.termux.com/

hzeller commented 3 years ago

For the overall question 'add this to termux', I've filed a packaging request with the termux packaging team https://github.com/termux/termux-packages/issues/7301

bropines commented 3 years ago

Thanks. Now a bug has been found. Transparency was lost in the last update. Check the l both on the PC and on termux.

hzeller commented 3 years ago

Yes, Transparency does not seem to work with the simple STB library, even though it claims that it should work. I need to have another look.

hzeller commented 3 years ago

Alright fixed (I forgot something). If you do another git pull and recompile, transparency should work now.

bropines commented 3 years ago

I would like to apologize. I didn't check absolutely all the dependencies and wrote about poor dependency support. As a result, it is better to remove the latest update and (preferably) remove the STB, since graphic artifacts appeared because of them, and performance began to drop significantly. I found all the dependencies except OpenSlide. Here are the instructions for which everything works like clockwork. The video also works calmly in termux according to this instruction. I suggest rolling back the updates to the beginning of our dialogue, because then everything worked well.

apt install cmake git clang pkg-config apt install libjpeg-turbo libexif ffmpeg graphicsmagick

git clone https://github.com/hzeller/timg.git cd timg mkdir build cd build

cmake ../ -DWITH_VIDEO_DECODING=on - DWITH_OPENSLIDE_SUPPORT=off -DWITH_GRAPHICSMAGICK=on -DWITH_TURBOJPEG=on -DWITH_STB_IMAGE=off make

hzeller commented 3 years ago

Yes, STB does have some artifacts, in particular the scaling is sub-optimal.

I think I'll leave the STB image code in if anyone actually needs to use it in a low-dependency environment (busybox ?), but if termux has all the other dependencies, it is probably better to use these. But since things are configurable as needed, there is nothing to be done for timg except that we now do have a small dependency feature if so desired :)

For the termux package, I suggest to write your updated set of parameters in the given issue https://github.com/termux/termux-packages/issues/7301

... or send a pull request to update the build-defines in the timg build script that @xeffyr already provided in the meantime.

bropines commented 3 years ago

Here is a clear example of how stb killed a picture (suddenly it will be needed) timg - the newest release with STB enabled timg2 - the oldest release without updates Timg3 - the newest release without stb Screenshot_2021-08-11-23-33-53-942_com termux If possible, return the transparency(not necessarily, but I would like to). Thanks

hzeller commented 3 years ago

ah, sorry, that was an issue independent of stb image. Should be fixed now.

bropines commented 3 years ago

Everything is working fine now. I think this branch can be closed, since we have achieved the addition of termux packages. In case of a bug, I will write to the appropriate branch. Thank you for your support

hzeller commented 3 years ago

Cool, have fun with timg in your termux terminal!