saitoha / PySixel

View full-pixel color graphics on SIXEL-supported terminals(xterm/mlterm/DECterm/Reflection/kermit/RLogin/tanasinn/yaft)
GNU General Public License v3.0
177 stars 13 forks source link

Distribute .pyx file for sixel_cimpl.c #3

Open Cheaterman opened 6 years ago

Cheaterman commented 6 years ago

Hello, everything is in the title :-3 it would be great to be able to maintain this. Thanks!

jph00 commented 5 years ago

@saitoha the current version is not compatible with py3.7 - if you could provide the pyx file, then we'd be happy to update the sixel_cimpl.c file for you.

hysrx commented 4 years ago

From looking at the file - there are these comments:

  /* "sixel_cimpl.pyx":48
 *         self._ncolor = ncolor
 * 
 *         if f8bit:  # 8bit mode             # <<<<<<<<<<<<<<
 *             self.DCS = '\x90'
 *             self.ST = '\x9c'
 */

do you think its possible to recreate the file, piece by piece?

Cheaterman commented 4 years ago

While it certainly is possible, it's not practical at all, and the actual Pyrex/Cython file is probably available somewhere on someone's computer... Then again, the last commit on this project was made half a decade ago, and I myself forgot I opened this issue. I'd consider this project dead, and more of an inspiration for a future rewrite or something.

hysrx commented 3 years ago

more of an inspiration for a future rewrite or something.

I guess that day would come. After interest with Sixels, I guess I took it upon myself to make a simple reverse engineerer for the sixel_cimpl.c file in the repo, with decent success, as I'd want to experiment with making a library of my own. I just thought I might as well I'd say this here rather than make a new issue for anybody who'd want to see what the old source code was (potentially).

PySixel Reverse Engineering

jph00 commented 3 years ago

Wow nice! Does this cython code compile and run correctly?

hysrx commented 3 years ago

Wow nice! Does this cython code compile and run correctly?

Haven't tested and honestly doubt it will - but I think that it would still be very useful for either a recreation of PySixel, or the creation of a new library which is something I am personally attempting.

jph00 commented 3 years ago

Thanks for the reply. If you do create a new library, please do pop a link here so us people following the issue know about it!

hysrx commented 3 years ago

Thanks for the reply. If you do create a new library, please do pop a link here so us people following the issue know about it!

It still is under development, and currently has no working files, nor proof of concept. But development is underway! https://github.com/hysrx/sixel.py

lubosz commented 1 year ago

@hysrx Nice script, it also works. But the file it's producing is actually in the repository.

This issue is not really valid and can be closed.

This is the file that is being compiled to sixel_cimpl.c: https://github.com/saitoha/PySixel/blob/master/sixel/converter.py

The Makefile symlinks converter.py to sixel_cimpl.pyx: https://github.com/saitoha/PySixel/blob/master/Makefile#L13

Not sure how the Makefile is supposed to be called, but you can build the repo by calling:

cython sixel/converter.py -o sixel/sixel_cimpl.c
pip install -e .

Also this package can be run without compiling converter.py to native code, it's actually checked at import time if it's available here: https://github.com/saitoha/PySixel/blob/master/sixel/sixel.py#L24

I would suggest just dropping the native code shenanigans all together, since displaying an image on the terminal is not a performance critical task.

But yes, this project needs a bit of maintaining.

lubosz commented 1 year ago

For my fork of this project, see: https://github.com/lubosz/PySixel

Most usefully, I am dropping the build to C all together: https://github.com/lubosz/PySixel/commit/179a940a0077927f9f558a25fce32933882ca72e

jph00 commented 1 year ago

Great news about the fork - thanks @lubosz!