Have to create placeholder images in Go project?

Overview of the "Sticket" - a Golang library, that generate placehold images with text 
07 August 2017   1367
Go

Open source project developed by a team at Google and many contributors from the open source community.

All web developers one way or another have to deal with the layout. The task is to harmoniously arrange the content on the page (text, images, video, etc.), make it flexible, responsive, beautiful and appropriate design idea.

Placeholder images help all web developers to make their products pretty and suitable for any screensize. Let's learn how to generate placeholder images in Go project easily.

Sticker is a Go library, that  generate placeholder images with text.

Installation

Make sure you have a working Go environment.

To install sticker, simply run:

go get github.com/muesli/sticker

To execute it from source:

cd $GOPATH/src/github.com/muesli/sticker
go get -u -v
go build && go test -v

Example

gen, err := sticker.NewImageGenerator(sticker.Options{
    TTFPath:         "/usr/share/fonts/TTF/Roboto-Bold.ttf",
    MarginRatio:     0.2,
    Foreground:      color.RGBA{0x96, 0x96, 0x96, 0xff},
    Background:      color.RGBA{0xcc, 0xcc, 0xcc, 0xff},
    BackgroundImage: img,
})
img, err := gen.NewPlaceholder("Lorem ipsum!", 400, 200)
...
 

Sticker will automatically pick a suitable font size, so the text will always fit neatly inside the image.

If you supply a background image, it will automatically be cropped and scaled (while maintaining its original aspect ratio) to the desired output size.

Learn more and download Sticker from GitHub.

Go 1.12 to be Available

Great news for all Go enthuisiast and developers; let's check what's new
28 February 2019   497

Go 1.12 programming language released, which is being developed by Google with the participation of the community as a hybrid solution combining high performance of compiled languages with such advantages of scripting languages as ease of writing code, speed of development and protection from errors. The project code is distributed under the BSD license.

These are main updates:

  • Native TLS 1.3 support. It is not enabled by default, it is necessary to set the option tls13=1 in the environment variable GODEBUG (package crypto / tls).
  • Improved module system support. Developers are preparing to include it by default in version 1.13.
  • Windows support on ARM architecture systems. For example, Go can now be used with Windows 10 IoT Core on Raspberry Pi 3 boards.
  • Improved compatibility with upcoming versions of macOS and iOS. The layer for making specific system calls is the libSystem library.

Get more information at official documents.

Starting with Go 1.13, support for macOS 10.10 "Yosemite" will be discontinued, as the minimum supported version of macOS will be 10.11 "El Capitan". The next release also plans to end support for the FreeBSD 10.x branch.