Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extraneous whitespace after rendered sixel #20

Open
taciturnaxolotl opened this issue Aug 7, 2024 · 1 comment
Open

Extraneous whitespace after rendered sixel #20

taciturnaxolotl opened this issue Aug 7, 2024 · 1 comment

Comments

@taciturnaxolotl
Copy link

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
}
@taciturnaxolotl
Copy link
Author

image
As shown here it is possible to have inline sixels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant