: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.

GoDoc

Read geopattern's development story geo_pattern: going on the Go path

Nested Squares Pattern

Generate beautiful tiling SVG patterns from a string. The string is converted into a SHA and a color and pattern are determined based on the values in the hash. The color is determined by shifting the hue from a default (or passed in) base color. One of 16 patterns is used (or you can specify one) and the sizing of the pattern elements is also determined by the hash values.

You can use the generated pattern as the background-image for a container. Using the base64 representation of the pattern still results in SVG rendering, so it looks great on retina displays.

See the GitHub Guides site as an example of this library in action. GitHub Guides use Original Ruby implementation.

Installation

go get github.com/pravj/geopattern

Usage

Example directory contains sample go programs that explains use of geopattern

API

Arguments for functions returning pattern's string

phrase : custom pattern phrase

args := map[string]string{"phrase": "My Custom Phrase"}

generator : custom pattern type

args := map[string]string{"generator": "plaid"}

color : custom background color

args := map[string]string{"color": "#3b5998"}

baseColor : custom base color that decides background color

args := map[string]string{"baseColor": "#ffcc00"}

Functions provided by package for pattern's string representation

Get the SVG string :

Generate(args)

Get the Base64 encoded string :

Base64String(args)

Get uri image string :

URIimage(args)

Available Pattern

chevrons

Chevrons

concentric-circles

Concentric-Circles

diamonds

Diamonds

hexagons

Hexagons

mosaic-squares

Mosaic-Squares

nested-squares

Nested-Squares

octagons

Octagons

overlapping-circles

Overlapping-Circles

overlapping-rings

Overlapping-rings

plaid

Plaid

plus-signs

Plus-Signs

sine-waves

Sine-Waves

squares

Squares

tessellation

Tessellation

triangles

Triangles

xes

Xes

Dependencies

go-colorful : for color space conversion


Made with Muzi and Appy by Pravendra Singh

Owner
Pravendra Singh
Product at Vernacular.ai Infrastructure. Data. Visualisation. Contributor @golang and @plotly.
Pravendra Singh
Similar Resources

An image server toolkit in Go (Golang)

An image server toolkit in Go (Golang)

Image Server An image server toolkit in Go (Golang) Features HTTP server Resize (GIFT, nfnt resize, Graphicsmagick) Rotate Crop Convert (JPEG, GIF (an

Dec 22, 2022

Use Windows API to capture a image from a Webcam in GoLANG

Windows-API-Capture-Webcam Use Windows API to capture a image from a Webcam in GoLANG Other Go is a amazing and powerful programming language. If you

Aug 13, 2022

ColorX is a library to determine the most prominent color in an image written in golang

ColorX is a library to determine the most prominent color in an image. ColorX doesn't use any sort of complex algorithms to calculate the prominent color, it simply loops over the image pixels and returns the color that occurs the most.

Nov 11, 2021

Image processing algorithms in pure Go

Image processing algorithms in pure Go

bild A collection of parallel image processing algorithms in pure Go. The aim of this project is simplicity in use and development over absolute high

Jan 6, 2023

Go package for fast high-level image processing powered by libvips C library

bimg Small Go package for fast high-level image processing using libvips via C bindings, providing a simple programmatic API. bimg was designed to be

Jan 2, 2023

Image processing library and rendering toolkit for Go.

blend Image processing library and rendering toolkit for Go. (WIP) Installation: This library is compatible with Go1. go get github.com/phrozen/blend

Nov 11, 2022

Decode embedded EXIF meta data from image files.

goexif Provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees. Suggestions and pull requests are welcome. Functionality

Dec 17, 2022

A lightning fast image processing and resizing library for Go

govips A lightning fast image processing and resizing library for Go This package wraps the core functionality of libvips image processing library by

Jan 8, 2023

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing

imaginary Fast HTTP microservice written in Go for high-level image processing backed by bimg and libvips. imaginary can be used as private or public

Jan 3, 2023
Comments
  • Blog link is incorrect

    Blog link is incorrect

    I just figured I would point out that you have what looks like an older format in your blog link. Here is the new link:

    https://pravj.github.io/blog/going-on-the-go-path/

    I'll edit the markdown and submit a pull request if you like, but I'm not at my desk right now.

  • Red color not working

    Red color not working

    I'm having some issues with the colors being generated.

    I am using pure red, #ff0000

    When I send in this map as the args:

    map[string]string{"phrase": "abc", "generator": "xes", "color": "#ff0000"}

    I am getting back this SVG: screen shot 2015-03-05 at 6 25 14 pm

    Raw SVG string: http://pastebin.com/A4R6mpnh

    When I try these two: map[string]string{"phrase": "abc", "generator": "xes", "color": "#ff2211"} map[string]string{"phrase": "abc", "generator": "xes", "color": "#aa2211"}

    The output image is exactly the same.

    Basically, it looks like it is completely ignoring the Red. Blue and Green seem to work fine.

  • Making the function arguments more idiomatic; move everything to one package

    Making the function arguments more idiomatic; move everything to one package

    Using a map of strings as the argument for Generate, Base64String, and URIimage seems like an anti-pattern in Go (It would be the right thing to do in Javascript). A more idiomatic approach would be to use a Struct. This change breaks reverse compatibility with this library.

    I also moved all the sub-packages into the geopattern package. If this is a problem, I can try and make it work with the sub-packages.

Generative Julia Set Image in Go
Generative Julia Set Image in Go

julia Generative Julia Set Image in Go In general terms, a Julia set is the boundary between points in the complex number plane or the Riemann sphere

Mar 20, 2022
Image - This repository holds supplementary Go image librariesThis repository holds supplementary Go image libraries

Go Images This repository holds supplementary Go image libraries. Download/Insta

Jan 5, 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
darkroom - An image proxy with changeable storage backends and image processing engines with focus on speed and resiliency.
darkroom - An image proxy with changeable storage backends and image processing engines with focus on speed and resiliency.

Darkroom - Yet Another Image Proxy Introduction Darkroom combines the storage backend and the image processor and acts as an Image Proxy on your image

Dec 6, 2022
Easily customizable Social image (or Open graph image) generator

fancycard Easily customizable Social image (or Open graph image) generator Built with Go, Gin, GoQuery and Chromedp Build & Run Simply, Clone this rep

Jan 14, 2022
An API which allows you to upload an image and responds with the same image, stripped of EXIF data

strip-metadata This is an API which allows you to upload an image and responds with the same image, stripped of EXIF data. How to run You need to have

Nov 25, 2021
Imgpreview - Tiny image previews for HTML while the original image is loading
Imgpreview - Tiny image previews for HTML while the original image is loading

imgpreview This is a Go program that generates tiny blurry previews for images t

May 22, 2022
Generate a favicon.ico from a short string
Generate a favicon.ico from a short string

icostring 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

Dec 24, 2021
Pure golang image resizing
Pure golang image resizing

This package is no longer being updated! Please look for alternatives if that bothers you. Resize Image resizing for the Go programming language with

Jan 9, 2023
golang package to find the K most dominant/prominent colors in an image
golang package to find the K most dominant/prominent colors in an image

prominentcolor Find the K most dominant colors in an image The Kmeans function returns the K most dominant colors in the image, ordered in the order o

Nov 7, 2022