Generate a favicon.ico from a short string

icostring

logo

Build Go Report Card License

Generate a file in the ICO format from a short string of either 16 or 64 characters ('a'..'p', 'q' and 't') + an optional hex encoded color value.

The idea is that this can be used for quickly specifying a favicon.ico file when writing web applications in Go.

Both a package that is useable from Go and a standalone icostring command line utility are included.

Quick installation

If Go 1.17 or later is installed, the latest version of the icostring utility can be installed with:

go install github.com/xyproto/icostring/cmd/icostring@latest

Example use

package main

import (
    "log"
    "os"

    "github.com/xyproto/icostring"
)

func WriteFile(filename, imageString string) error {
    f, err := os.Create(filename)
    if err != nil {
        return err
    }
    if err := icostring.WriteImage(f, imageString); err != nil {
        return err
    }
    return f.Close()
}

func main() {
    if err := WriteFile("favicon.ico", "aaaafqqfaqqapppp"); err != nil {
        log.Fatalln(err)
    }
}

Here aaaafqqfaqqapppp is used, but aaaaaaaa aaaqqaaa ffqqqqff ffqqqqff aaqqqqaa aaqqqqaa pppqqppp pppppppp #08f is also a valid icostring.

String format

  • The string represents a 4x4 or 8x8 image that will be scaled up to 16x16 when it is converted to an ICO.
  • The string is a maximum of 73 characters long (letters + hex color). Spaces are ignored.
  • The first 4 or 8 characters is the top row, the next series of letters is the second row etc.
  • a is the darkest grayscale color, b is a bit lighter etc.
  • p is the lightest grayscale color.
  • q is a custom color that is either red, or defined at the end of the string with a hex color, either with or without alpha, like #ffffffff or #fff.
  • t is transparent.

Example short form image strings and images

  • A dark image: aaaaaaaaaaaaaaaa (a is the darkest grayscale color)
  • A blue image: qqqqqqqqqqqqqqqq#00f. (q is the custom color that is optionally defined at the end of the string).
  • A red image: qqqqqqqqqqqqqqqq (the default custom color is red, #f00)
  • A dark gray square surrounded by transparent pixels: tttt taat taat tttt.
  • A yellow square surrounded by transparent pixels: tttttqqttqqttttt#ff0.
  • A tiny icostring logo: aaaafqqfaqqapppp#5080ff.
aaaaaaaaaaaaaaaa qqqqqqqqqqqqqqqq tttttaattaattttt aaaafqqfaqqapppp#5080ff
dark red transparent art

General info

Owner
Alexander F. Rødseth
Software Engineer, Arch Linux TU, Go/Python/C++/C developer and open source enthusiast.
Alexander F. Rødseth
Similar Resources

Go-Generative-Art-A - Generate PNG art from source images! GOLang Generative Art

Go-Generative-Art-A - Generate PNG art from source images! GOLang Generative Art

GO Lang Generative Art Tool A Take source images and generate art utilizing sour

Nov 21, 2022

A generator of cats/birds/mobilizon pictures optimised to generate or random avatars, or defined avatar from a "seed"

A generator of cats/birds/mobilizon pictures optimised to generate or random avatars, or defined avatar from a "seed". A derivation by David Revoy from the original MonsterID by Andreas Gohr's.

Feb 7, 2022

High-Performance Shortlink ( Short URL ) app creator in Golang. For privacy reasons, you may prefer to host your own short URL app and this is the one to use.

High-Performance Shortlink ( Short URL ) app creator in Golang. For privacy reasons, you may prefer to host your own short URL app and this is the one to use.

About The Project Shortlink App in Golang Multiple Node based Architecture to create and scale at ease Highly performant key-value storage system Cent

Jan 3, 2023

Favicon service written in Go

Favicon service written in Go

favicon-service (besticon) This is a favicon service: Supports favicon.ico and apple-touch-icon.png Simple URL API Fallback icon generation Docker ima

Dec 17, 2022

Golang metrics for calculating string similarity and other string utility functions

strutil strutil provides string metrics for calculating string similarity as well as other string utility functions. Full documentation can be found a

Jan 3, 2023

Recursively searches a map[string]interface{} structure for another map[string]interface{} structure

msirecurse Recursively searches a map[string]interface{} structure for existence of a map[string]interface{} structure Motivation I wrote this package

Mar 3, 2022

Inflection is a string transformation library. It transforms strings from CamelCase to underscored string.

Inflection Inflection is a string transformation library. It transforms strings from CamelCase to underscored string. This is an implement of Inflecti

Jul 25, 2022

Generate a cryptographically strong random string :lock:

Crypto Random String You can use this library to generate a cryptographically strong random string for creating an identifier, slug, salt, PIN code, f

Oct 7, 2021

generate Wireguard keypairs with a given prefix string

wireguard-vanity-address Generate Wireguard keypairs with a given prefix string. The Wireguard VPN uses Curve25519 keypairs, and displays the Base64-e

Nov 9, 2022

JOB, make your short-term command as a long-term job. 将命令行规划成任务的工具

job make your short-term command as a long-term job Install Shell Install (Linux & MacOS) # binary will be $(go env GOPATH)/bin/job $: curl -sfL https

Nov 12, 2022

Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein.

SipHash (Go) Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein (http://131002.net/sip

Dec 25, 2022

Super short, fully unique, non-sequential and URL friendly Ids

Generator of unique non-sequential short Ids The package shortidenables the generation of short, fully unique, non-sequential and by default URL frien

Dec 30, 2022

Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein.

SipHash (Go) Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein (http://131002.net/sip

Dec 25, 2022

Short video direct link acquisition 短视频直连获取工具

Short video direct link acquisition 短视频直连获取工具

Glink 短视频去水印一键解析应用 Short video direct link acquisition 短视频直连获取工具 Glink是一款基于go语言开发的短视频解析应用,前端使用vue+argon主题,后端使用go-fiber框架,支持web在线模式、客户端模式。

Dec 7, 2022

Short link 短链接服务器

Go 短链接生成器 Short link 短链接服务器 什么是短链接 就是把普通网址,转换成比较短的网址。

May 8, 2021

short-url distributed and high-performance

durl 是一个分布式的高性能短链服务,逻辑简单,并提供了相关api接口,开发人员可以快速接入,也可以作为go初学者练手项目.

Jan 2, 2023

👄 The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

👄 The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

👄 The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

Dec 25, 2022

👄 The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

👄 The most accurate natural language detection library in the Go ecosystem, suitable for long and short text alike

Its task is simple: It tells you which language some provided textual data is written in. This is very useful as a preprocessing step for linguistic data in natural language processing applications such as text classification and spell checking. Other use cases, for instance, might include routing e-mails to the right geographically located customer service department, based on the e-mails' languages.

Dec 29, 2022

Short examples of common anti-patterns in Go Web Applications.

Go Web App Anti-Patterns This repository contains short examples of common anti-patterns in Go Web Applications. For complete description, see Common

Dec 31, 2022
Paprika is a toolbox for creating short clips from multiple png files.
Paprika is a toolbox for creating short clips from multiple png files.

Paprika Paprika is a toolbox for creating short clips from multiple png files. Requirements This program is mainly a wrapper around ffmpeg. As such, y

Feb 16, 2022
:triangular_ruler: Create beautiful generative image patterns from a string in golang.
:triangular_ruler: Create beautiful generative image patterns from a string in golang.

geopattern Create beautiful generative image patterns from a string in golang. Go port of Jason Long's awesome GeoPattern library. Read geopattern's d

Dec 29, 2022
generativeart is a Go package to generate many kinds of generative art.
generativeart is a Go package to generate many kinds of generative art.

generativeart is a Go package to generate many kinds of generative art. The goal is to collect some excellent generative art (implemented in R or Processing), and rewrite them in Go again

Dec 29, 2022
:football: Generate your own O'RLY animal book cover to troll your colleagues | 生成你自己的O'RLY动物书封面,让你的同事惊掉下巴

English | 中文 O'RLY Cover Generator O'RLY Cover Generator is a parody book cover generator, implemented in Golang and Vue.js, supporting a wide range o

Dec 24, 2022
An iterative algorithm to generate high quality triangulated images.
An iterative algorithm to generate high quality triangulated images.

Triangula uses a modified genetic algorithm to triangulate images. It works best with images smaller than 3000px and with fewer than 3000 points, typically producing an optimal result within a couple of minutes.

Jan 8, 2023
Generate image plots of processes' memory usage very quickly, within a single binary.
Generate image plots of processes' memory usage very quickly, within a single binary.

memplot A small utility written in golang to quickly plot memory usage of processes. memplot constantly samples memory usage of a process, for a given

Apr 17, 2021
Generate a TwitterCard(OGP) image for your Hugo posts.
Generate a TwitterCard(OGP) image for your Hugo posts.

Twitter Card Image Generator Generate Twitter card (OGP) images for your blog posts. Supported front-matters are title, author, categories, tags, and

Dec 17, 2022
code2img can generate image of source code
code2img can generate image of source code

code2img code2img can generate image of source code. This was inspired by carbon and silicon Features Doesn't need browser & Internet Copy image of so

Nov 15, 2022
Generate high-quality triangulated art from images.
Generate high-quality triangulated art from images.

An iterative algorithm to generate high quality triangulated images.

May 26, 2021
API for generate image to ASCII Art

ASCII API Generate ASCII art from image. You can try this API here: ascii.projec

Jul 1, 2022