(cons colour-map
(reverse rows)))))
+(defun sixel-pad-rows (sixel-image)
+ "Pad out contents of rows in SIXEL-IMAGE so that all rows are the same length."
+ (let ((width (car (sixel-image-dims sixel-image)))
+ (rows (cdr sixel-image)))
+ (dotimes (row-idx (length rows))
+ (let* ((row-cdr (nthcdr row-idx rows))
+ (row-width (length (car row-cdr))))
+ (if (< row-width width)
+ (setcar row-cdr (append (car row-cdr)
+ (make-list (- width row-width)
+ [nil nil nil nil nil nil])))))))
+ sixel-image)
+
(defun sixel-image-colour-map (sixel-image)
"Extract colour map from SIXEL-DATA."
(car sixel-image))
"Returns an XPM image representation of the SIXEL graphic encoded in STRING."
(let* ((param-string (sixel-get-params string))
(data-string (sixel-get-data string))
- (sixel-image (sixel-process-data data-string)))
+ (sixel-image (sixel-pad-rows (sixel-process-data data-string))))
(if (string-prefix-p "\eP" string)
(concat
"/* XPM */"