Skip to content

Extraneous whitespace after rendered sixel #20

@taciturnaxolotl

Description

@taciturnaxolotl

image

As shown in the image above using this simple code snippet below quite a bit of extra whitespace is added making it impossible to use inline

func SixelEncode(url string, width uint) string {
	// download the image
	resp, err := http.Get(url)
	if err != nil {
		log.Error("erroring getting image", "err", err)
		return ""
	}
	defer resp.Body.Close()

	// decode the image
	img, _, err := image.Decode(resp.Body)
	if err != nil {
		log.Error("erroring decoding image", "err", err)
		return ""
	}

	// resize image
	m := resize.Resize(width, 0, img, resize.NearestNeighbor)

	// encode the image as sixel and print to stdout
	var buf bytes.Buffer
	sixel.NewEncoder(&buf).Encode(m)
	result := buf.String()
	fmt.Println(result + "lol")

	return result
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions