homelan/dec-sixel

Provides a class that produces the sixel terminal ouput needed to display a png|jepg|gif image

dev-master 2025-05-19 15:57 UTC

This package is auto-updated.

Last update: 2025-05-19 16:12:02 UTC


README

PHP Class for reading in image files, and producing the output for a terminal that supports sixel, to display that image.

Install

composer require homelan/dec-sixel

Usage

There is one class prodvided by the package, which reads in an image file, and produces the sixel escape sequence.

    require_once 'vendor/autoload.php';
    use HomeLan\Retro\DEC\Terminal\Gfx\SixelConverter;

    // Create converter instance
    $oConverter = new SixelConverter();
    
    // Configure converter
    $oConverter->setMaxDimensions(200, 300)  // Set reasonable terminal size
               ->setColorCount(32)           // Use 64 colors for better terminal compatibility
               ->loadImage('some-image.png');
    
    // Convert and output
    echo "Displaying image in Sixel format:\n";
    echo $oConverter->convertToSixel();