All Projects → denisbrodbeck → sqip

denisbrodbeck / sqip

Licence: MIT license
SQIP is a tool for SVG-based LQIP image creation written in go

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to sqip

cmus-control
Control cmus with Media Keys ⏪ ▶️ ⏩ under OS X.
Stars: ✭ 51 (+10.87%)
Mutual labels:  mit-license
SwedbankJson
Unofficial API client for the Swedbank's and Sparbankerna's mobile apps in Sweden.
Stars: ✭ 69 (+50%)
Mutual labels:  mit-license
seedpress-cms
A headless CMS built in Express for PostgresQL using Sequelize. Generally follows the Wordpress post and term schema.
Stars: ✭ 71 (+54.35%)
Mutual labels:  mit-license
nhwcodec
NHW : A Next-Generation Image Compression Codec
Stars: ✭ 56 (+21.74%)
Mutual labels:  image-compression
cometa
Lightweight, header-only C++14 metaprogramming library. Pattern matching, compile-time stuffs and algorithms (arrays, type information (CTTI), string manipulation), 'value-or-errorcode' union-like type, type for passing named arguments, useful constexpr functions and many more. (MIT license)
Stars: ✭ 56 (+21.74%)
Mutual labels:  mit-license
gorest
Go RESTful API starter kit with Gin, JWT, GORM (MySQL, PostgreSQL, SQLite), Redis, Mongo, 2FA, email verification, password recovery
Stars: ✭ 135 (+193.48%)
Mutual labels:  mit-license
dwarlixir
A dwarf-fortress clone / MUD / side project in Elixir
Stars: ✭ 46 (+0%)
Mutual labels:  mit-license
wikibot
A 🤖 which provides features from Wikipedia like summary, title searches, location API etc.
Stars: ✭ 25 (-45.65%)
Mutual labels:  mit-license
cgol
Conway's Game of Life in the Terminal
Stars: ✭ 32 (-30.43%)
Mutual labels:  mit-license
Imgbot
An Azure Function solution to crawl through all of your image files in GitHub and losslessly compress them. This will make the file size go down, but leave the dimensions and quality untouched. Once it's done, ImgBot will open a pull request for you to review and merge. [email protected]
Stars: ✭ 1,017 (+2110.87%)
Mutual labels:  image-compression
ocat
The Open Capture and Analytics Tool (OCAT) provides an FPS overlay and performance measurement for D3D11, D3D12, and Vulkan
Stars: ✭ 233 (+406.52%)
Mutual labels:  mit-license
heic2hevc
convert HEIC file to H.265 bitstream(Annex.B)
Stars: ✭ 25 (-45.65%)
Mutual labels:  image-compression
tinify-net
.NET client for the Tinify API.
Stars: ✭ 45 (-2.17%)
Mutual labels:  image-compression
academia-hugo
Academia is a Hugo resume theme. You can showcase your academic resume, publications and talks using this theme.
Stars: ✭ 165 (+258.7%)
Mutual labels:  mit-license
ANODA-Turn-Timer
ANODA Open Source iOS Swift example app
Stars: ✭ 19 (-58.7%)
Mutual labels:  mit-license
pngloss
Lossy compression of PNG images
Stars: ✭ 73 (+58.7%)
Mutual labels:  image-compression
JustAnotherVoiceChat
TeamSpeak 3 plugin to control 3D voice communication in games
Stars: ✭ 21 (-54.35%)
Mutual labels:  mit-license
pre-commit-golang
Pre-commit hooks for Golang with support for monorepos, the ability to pass arguments and environment variables to all hooks, and the ability to invoke custom go tools.
Stars: ✭ 208 (+352.17%)
Mutual labels:  mit-license
tinify-ruby
Ruby client for the Tinify API.
Stars: ✭ 41 (-10.87%)
Mutual labels:  image-compression
Halma
Halma Game Built With The Awesome libGDX framework
Stars: ✭ 20 (-56.52%)
Mutual labels:  mit-license


Image of a blurred gopher
SQIP does SVG-based LQIP image creation

… because even blurred preview images need to look good :godmode:

GoDoc Go Report Card

Overview

SQIP is a go implementation of Tobias Baldauf‘s SVG-based LQIP technique.

LQIP (Low Quality Image Placeholders) boils down to this:

  • load the page initially with low quality images
  • once the page loaded (e.g. in the onload event), replace them with full quality images

So instead of waiting for the final image to be rendered, we can serve a highly compressed image first, and then switch to the large one.

SQIP is an evolution of the classic LQIP technique: it makes use of Primitive to generate a SVG consisting of several simple shapes that approximate the main features visible inside the image, optimizes the SVG using minify and adds a Gaussian Blur filter to it.

This produces a SVG placeholder which weighs in at only ~800-1000 bytes, looks smooth on all screens and provides an visual cue of image contents to come.

Tobias Baldauf‘s project is written in js and depends on an installed version of node, go, primitive and multiple npm modules. This project aims to minimize the dependencies down to exactly one — this go package.

Installation

Get the cli app directly to your $GOPATH/bin with

go get -u github.com/denisbrodbeck/sqip/cmd/sqip

Import the library with

import "github.com/denisbrodbeck/sqip"

CLI usage

# Generate a SVG placeholder and print an example <img> tag to stdout
sqip input.png

# Save the placeholder SVG to a file instead of printing the <img> to stdout
sqip -o output.svg input.png

# Customize the number of primitive SVG shapes (default=8) to influence bytesize or level of detail
sqip -n 4 input.jpg

All available flags:

sqip [-n <int>] [-o <path>] [options...] <file>
Flags:
  -n  <int>     number of primitive SVG shapes (default: 8)
  -o  <path>    save the placeholder SVG to a file (default: empty)
Options:
  -mode  <int>  shape type (default: 0)
  -alpha <int>  color alpha (use 0 to let the algorithm choose alpha for each shape) (default: 128)
  -bg    <hex>  background color as hex (default: avg)

API usage

Here is an example app:

package main

import (
	"log"
	"runtime"
	"github.com/denisbrodbeck/sqip"
)

func main() {
	in := "path/to/image.png"   // input file
	out := "path/to/image.svg"  // output file
	workSize := 256             // large images get resized to this - higher size grants no boons
	count := 8                  // number of primitive SVG shapes
	mode := 1                   // shape type
	alpha := 128                // alpha value
	repeat := 0                 // add N extra shapes each iteration with reduced search (mostly good for beziers)
	workers := runtime.NumCPU() // number of parallel workers
	background := ""            // background color (hex)

  // create a primitive svg
	svg, width, height, err := sqip.Run(in, workSize, count, mode, alpha, repeat, workers, background)
	if err != nil {
		log.Fatal(err)
	}
	// save svg to file
	if err := sqip.SaveFile(out, svg); err != nil {
		log.Fatal(err)
	}
	// create example img tag
	tag := sqip.ImageTag(out, sqip.Base64(svg), width, height)
	log.Print(tag)
}

Credits

The Go gopher was created by Denis Brodbeck, based on original artwork from Renee French and Takuya Ueda.

License

The MIT License (MIT) — Denis Brodbeck. Please have a look at the LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].