kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.16k stars 972 forks source link

Support jpeg for pixel data transfer #4341

Closed MatanZ closed 2 years ago

MatanZ commented 2 years ago

Is your feature request related to a problem? Please describe. Displaying high resolution photographs takes a long time over slow links. Those are not well compressed by PNG/deflate. Jpeg format, being lossy, allows the application (and thus, the user) to select the tradeoff between quality an bandwidth/time.

Describe the solution you'd like I would like the graphics protocol to allow jpeg files in the same manner that it allows PNG and RGB/A.

Describe alternatives you've considered Transferring the files out of band does not make sense for my use case. I don't want the files stored on the local computer. An icat replacement script would need to recognize the machine I work on, a way to connect to it, and then send the file to a location that the local kitty can access, which is a problem is systems that try to separate applications to their own "sandboxes".

Additional context I connect to a remote computer with low upload bandwidth over SSH, over a VPN. A simple icat of an image takes over 20 seconds with RGB transfer, and only about a second with jpeg transfer.

I know that this was discussed a few times (#3758 #33 ):

Terminals, unlike browsers, are not going to be forever adding support for new image formats. I value stability over optimal bandwidth.

Adding another image format would require adding another decoder library dependency. So while I am not totally opposed to it, it would require a pretty high bar for qualification.

JPEG is not a new image format. It is 30 years old, and is a standard that is supported practically everywhere. Similarly, libjpeg is not an onerous dependency, as it is installed on practically any Linux system that has X11 or Wayland.

Adding jpeg support will have the added benefit of allowing background images to be .jpg files, saving the users the need to convert images for this use.

kovidgoyal commented 2 years ago

I'm afraid not. Once I open the door to this, everyone and their great aunt is going to demand support for their favorite image format of choice. Why JPEG why not WEBP? Or BGF or JPEG-XR or JPEG-2000

And just to note the presence or absence of a library on Linux is irrelevant.

D3vil0p3r commented 1 year ago

I'm afraid not. Once I open the door to this, everyone and their great aunt is going to demand support for their favorite image format of choice. Why JPEG why not WEBP? Or BGF or JPEG-XR or JPEG-2000

And just to note the presence or absence of a library on Linux is irrelevant.

You can say "Because YES" for JPEG and "Because NO" for WEBP or BGF or JPEG-XR or JPEG-2000. I agree with the motivation of @MatanZ guy.