On Wed, Jan 31, 2018 at 4:02 PM, Samuel Lelievre
<[email protected]> wrote:
> [Warning: this is a reply to a 5-month-old post.]
>
> Wed 2017-08-30 13:51:58 UTC, Erik Bray:
>
>>
>> Hi,
>>
>> Has anyone here tried playing around with the SIXEL graphics format
>> for Sage plots before?  SIXEL [1] is a graphics format that was
>> supported by VT300 terminals for displaying images in the terminal,
>> and many terminal emulators support it.  For example, gnuplot has long
>> been able to display plots in SIXEL format (see attached screenshot),
>> and I've used in the past for displaying images in the terminal (there
>> are programs that can convert existing images to SIXEL and cat them).
>>
>> I just wonder if anyone's found a workaround for this to work in Sage,
>> rather than have plots pop up in a separate image viewer.
>>
>> ISTM if nothing else, this could be done in a hackish way by taking
>> images output by Sage, pass them through a SIXEL converter, and then
>> print the SIXEL data.  I haven't tried fully integrating this, but
>> simply print()ing a SIXEL image from Python works from the Sage REPL,
>> at least on my terminal.
>>
>> Surely I'm not the only one who's tried this?
>>
>> Erik
>>
>> [1] https://en.wikipedia.org/wiki/Sixel
>
> Sorry I didn't reply when you wrote this, the last days of August
> and first days of September I was busy moving to Mexico...
>
> I was amazed by your post and screenshot, never having thought
> such integration of graphics in the terminal was possible. Having
> this for the Sage REPL would be wonderful. Please open a ticket
> and/or write instructions in a blog post or a wiki page.

Heh, I sort of lost interest when I posted this and nobody else seemed
interested.

But I agree it would be very nice to have.  There's a very nice Python
library that implements this (called, naturally, PySixel
https://github.com/saitoha/PySixel) and I it would be easy to add as a
possible output formatter for 2D graphics in Sage.

The one downside to this is that not all terminals support this
(though many common ones do), and there's no easy way from within Sage
to detect whether the user's terminal would support it.
It might be possible with some obscure terminal control codes to
detect but I'm not sure.  The best way is to just enable it and try
it, and if it works--great--enable it by default as a setting or
something.

There also seem to be some other terminal-specific proprietary codes
for image rasterization in terminals, but Sixel is a documented DEC
standard and seems to be in a lot of terminals (including xterm,
mintty on Windows, and I'm pretty sure the terminal on OSX).

Best,
E

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to