sixel graphics lib-sixel
Jul 20, 2019 14:03:50 GMT 1
Post by alexfish on Jul 20, 2019 14:03:50 GMT 1
Hi All
Whilst on with html2text lib
now have a module using lib-sixel
hence will need sixel devs
as a side note possible will only run in xterm or mlterm uxterm
if not mlterm will need to switch term mode
using
IE
A bit of code to get Started then see what do with it;
BR
Alex
Whilst on with html2text lib
now have a module using lib-sixel
hence will need sixel devs
as a side note possible will only run in xterm or mlterm uxterm
if not mlterm will need to switch term mode
using
-ti 340
IE
xterm -ti 340
A bit of code to get Started then see what do with it;
PRAGMA LDFLAGS -lsixel
PRAGMA INCLUDE <sixel/sixel.h>
CONST X_TERM ='7'
CONST ML_TERM = '8'
CONST X_COLOR = "16"
CONST ML_COLOR = "256"
PROTO fprintf
OPTION PARSE FALSE
FUNCTION IMG2SIXEL(char modes,const char * color, const char* txt,const char * width , const char * height) TYPE int
LOCAL status = SIXEL_FALSE TYPE SIXELSTATUS
LOCAL *encoder = NULL TYPE sixel_encoder_t
status = sixel_encoder_new(& encoder, NULL)
IF (SIXEL_FAILED(status)) THEN
GOTO error
ENDIF
'Color Mode
status = sixel_encoder_setopt(encoder,'p',color)
IF (SIXEL_FAILED(status)) THEN
GOTO error
ENDIF
' MODE X_TERM OT ML_TERM
status = sixel_encoder_setopt(encoder,modes,NULL)
IF (SIXEL_FAILED(status)) THEN
GOTO error
ENDIF
' width *% or pixels wide
status = sixel_encoder_setopt(encoder,'w', width)
IF (SIXEL_FAILED(status)) THEN
GOTO error
ENDIF
' width *% or pixels wide
status = sixel_encoder_setopt(encoder, 'h', height)
' ENCODE THE FILE
status = sixel_encoder_encode(encoder, txt)
IF (SIXEL_FAILED(status)) THEN
GOTO error
ENDIF
/* mark as success */
status = SIXEL_OK
GOTO end
LABEL error
fprintf(stderr, "%s\n%s\n", sixel_helper_format_error(status),sixel_helper_get_additional_message())
status = (-1)
LABEL end
sixel_encoder_unref(encoder)
RETURN status
END FUNCTION
PRINT "HELLO SIXEL "
' Change to your path to file
LOCAL imagefile = "/home/pi/Downloads/libsixel/images/egret.jpg" TYPE STRING
IMG2SIXEL(X_TERM,X_COLOR, imagefile,"50%","50%")
BR
Alex