Skip to content

image addon serialization #5845

@jerch

Description

@jerch

Currently images printed to the terminal cannot be serialized. Previous tests regarding image serialization were done in jerch/xterm-addon-image#48. They revealed the following cornerstones:

  • add QOI image format for performance reasons
  • implement an image sequence format suitable for serialization
    • separate data load from placements
    • possible to shard data parts
  • extend serialize addon with at least row-level events

Steps to be taken
As a possible cause of actions I suggest the following steps:

  • add QOI decoder to IIP (maybe kitty too?) --> QOI support for IIP #5846
  • implement serialization image sequence
    • add QOI encoder
    • learn from kitty protocol about sharding and placements
    • spec internal sequence with:
      • data load
      • placements
  • fix resize handling (see image addon: proper resizing #5861)
  • extend serialization
    • add events to serialize addon
    • expose events on serialize addon API
  • register image serialization to serialize events

The reason for using QOI and not one of the standard formats is mostly performance. QOI yields comparable file sizes to PNG, but is in previous tests ~4 times faster to process.

For the custom sequence we can take bits from the kitty protocol, or extend it for encoding purposes with QOI. The tricky part will be to harmonize it with SIXEL and IIP states though. Currently I don't aim to write a full serialization for all protocol types, as this seems overbloated. Instead we should extract the minimal needed bits to restore images states correctly with one sequence and image format only.

Up for discussion first, as it will introduce quite some changes across the codebase.
FYI: @Tyriar, @anthonykim1, @PerBothner

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions