Have to create placeholder images in Go project?

Overview of the "Sticket" - a Golang library, that generate placehold images with text 
07 August 2017   1195
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.

Microsoft to Develop Golua

Golua is Lua 5.3 engine, implemented in Go programming language
19 November 2018   383

Microsoft has released to the public golua engine designed to execute scripts in the Lua language. The development is distributed under the open MIT license and is available in the GitHub repository. The project is implemented in the language of Go.

There are already several implementations of Lua VM in Go, for example, DCLua, GoLua or glua. However, the developers state that they needed support for the syntax of version 5.3, and none of the existing tools could offer this either now or in the near future. In addition, simple and clear software interfaces were required to integrate the engine with Go.

The new development is based on the architecture, focused on convenient debugging, search and error handling. Although the creators of golua recognize that they have not yet managed to achieve full compliance with specification 5.3, they intend to further develop the project.

Lua is an open source scripting programming language interpreter. It is distinguished by simple integration into other languages ​​and the possibility of implementing a large number of software entities with a minimum of syntax tools.

The official Lua interpreter is written in C. Go was developed by Google as a replacement for C and C ++ and has the potential to provide greater speed. The company maintains and regularly updates its development; at the end of the summer of 2018, Go 1.11 was released.