• Stars
    star
    22
  • Rank 1,014,783 (Top 21 %)
  • Language
    Crystal
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pure Crystal implementation of BlurHash algorithm

blurhash.cr CI Releases License

A pure Crystal implementation of Blurhash. The API is stable, however the hashing function in either direction may not be.

Blurhash is an algorithm written by Dag Ågren for Wolt (woltapp/blurhash) that encodes an image into a short (~20-30 byte) ASCII string. When you decode the string back into an image, you get a gradient of colors that represent the original image. This can be useful for scenarios where you want an image placeholder before loading, or even to censor the contents of an image à la Mastodon.

Currently supports PNG and JPEG file types.

Installation

Library

  1. Add the dependency to your shard.yml:

    dependencies:
      blurhash:
        github: Sija/blurhash.cr
  2. Run shards install

CLI

  1. Run shards build --release

Usage

Library

require "blurhash"

puts Blurhash.encode(
  x_components: 4,
  y_components: 3,
  path: Path["foo.png"]
)

CLI

$ ./bin/blurhash 4 3 foo.png

Contributing

  1. Fork it (https://github.com/Sija/blurhash.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

More Repositories

1

garb

A Ruby wrapper for the Google Analytics API
Ruby
147
star
2

raven.cr

Raven is a Crystal client for Sentry
Crystal
120
star
3

debug.cr

Debug macro for Crystal
Crystal
92
star
4

ipaddress.cr

A Crystal library to handle IPv4 and IPv6 addresses in a modern and productive way.
Crystal
43
star
5

retriable.cr

Retriable.cr is a simple DSL to retry failed code blocks
Crystal
38
star
6

any_hash.cr

Better JSON::Any for Crystal
Crystal
33
star
7

backtracer.cr

Crystal shard aiming to assist with parsing backtraces into a structured form.
Crystal
16
star
8

ksuid.cr

Crystal implementation of K-Sortable Globally Unique IDs
Crystal
16
star
9

crystal-dash-docset

Dash docset generator for Crystal
Shell
16
star
10

gphoto2.cr

Crystal shard wrapping libgphoto2
Crystal
15
star
11

climate.cr

Tiny tool to make your CLI output 🌈 coloured
Crystal
14
star
12

serialport.cr

Crystal bindings for libserialport: cross-platform library for accessing serial ports.
Crystal
12
star
13

base62.cr

Base62 encoder/decoder for Crystal
Crystal
10
star
14

crystal-environment

Crystal::Environment
Crystal
7
star
15

gphoto2-web

Web API for libgphoto2
Crystal
6
star
16

gitbook2pdf

CLI utility to turn a published GitBook website into a collection of PDFs for offline reading
JavaScript
3
star
17

Gizmo

Quick'n'easy file based content management system
PHP
2
star
18

jsonl.cr

Crystal shard for handling JSONL (JSON Lines) parsing
Crystal
1
star
19

Sija

1
star
20

coffeeshop

Unfinished Coffee powered, Express based framework for Node.js
CoffeeScript
1
star
21

kPilot.w3

Web backend for kPilot Konnekt IM plugin.
PHP
1
star
22

markdown

PSR-0 compliant Markdown library
PHP
1
star
23

seedling

Rails 3 plugin for a database-independent YAML seeds import/export.
Ruby
1
star
24

MazeSolver

Maze solver written in PHP 5.
PHP
1
star
25

kZmieniacz

kZmieniacz to wtyczka dla komunikatora Konnekt pozwalająca zmieniać status opisowy jednocześnie we wszystkich wykorzystywanych sieciach.
C++
1
star
26

photoindex

Ancient, self-contained php gallery script.
PHP
1
star
27

resque-dry

Ruby
1
star
28

swift

Never finished C++ templating engine.
C++
1
star
29

kulturadaru

PHP
1
star
30

smartypants

PSR-0 compliant Smartypants library
PHP
1
star
31

kAway

Away system for the Konnekt IM
C++
1
star
32

git-rewrite-author

CLI tool for rewriting author/committer history of a git repository
Crystal
1
star
33

QRKit

QR Reader in Objective C ported from zxing
C++
1
star
34

thumb-cutter

Blazingly fast thumb cutting and image juggling middleware for any node/express.js kitchen sink
JavaScript
1
star
35

sunspot_resque

Sunspot-Resque Session Proxy
Ruby
1
star
36

jquery.clamp

JavaScript with CSS "overflow: ellipsis" line clamping, as jQuery plugin and standalone AMD module
CoffeeScript
1
star