• Stars
    star
    288
  • Rank 143,432 (Top 3 %)
  • Language
    C
  • License
    MIT License
  • Created over 5 years ago
  • Updated 15 days ago

Reviews

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

Repository Details

Encode an image as a small string that can be saved in the database, returned in API responses, and displayed as a blurred preview before the real image loads

Blurhash

This is a Ruby binding for the Blurhash library. With it you can encode an image as a small string that can be saved in the database, returned in API responses, and displayed as a blurred preview before the real image loads.

Blurhash is written by Dag Ã…gren.

Installation

Add this line to your application's Gemfile:

gem 'blurhash'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blurhash

Usage

To generate the blurhash string from an image file, you need to read in the image pixel data yourself, for example with RMagick:

require 'blurhash'
require 'rmagick'

image = Magick::ImageList.new('foo.png')

puts Blurhash.encode(image.columns, image.rows, image.export_pixels)

To display the visual component once you have the blurhash string, you need another library in JavaScript, Swift, Kotlin and so on. Fore more information, see the original blurhash repository.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Gargron/blurhash. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Blurhash project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

More Repositories

1

fileupload

PHP FileUpload library that supports chunked uploads
PHP
459
star
2

cobalt

An open-source self-hosted YouTube alternative. Subscribe to other users on other servers using ActivityPub. Reduced bandwidth costs for server owners via WebTorrent.
Ruby
93
star
3

xmpp-web

A modern XMPP client for the web
JavaScript
66
star
4

zoomie

A JavaScript zoom-on-hover tool for images, like a magnifying glass. Really cool.
JavaScript
43
star
5

boost-bot

Mastodon bot that boosts all local toots with a chosen hashtag.
JavaScript
24
star
6

tusky-api

Node.js server that proxies Mastodon notifications to an app's push notifications through Firebase Cloud Messaging
JavaScript
20
star
7

blurhash.js

Mirror
TypeScript
14
star
8

baron

Baron is a WebRTC-based IM for the browser
JavaScript
12
star
9

pubsubhubbub

A mountable PubSubHubbub server for Rails
Ruby
9
star
10

Snowfall

HTML5-canvas based snowfall JavaScript
JavaScript
9
star
11

Paginator

Minimal PHP paginator class. Generates pagination navigation based on total items number and offset.
PHP
8
star
12

book-toot-bot

A Ruby script that will post a book to a Mastodon account.
Ruby
7
star
13

passwordCheck.js

Password strength evaluator
JavaScript
5
star
14

Capture

Open-source quick screen grabbing tool in Python
Python
4
star
15

ElasticEmail-PHP

PHP class for ElasticEmail.com
PHP
3
star
16

generic-ban

A generic PHP ban class. Supports IP bans, alt account bans, and expiring bans. Uses redis.
PHP
3
star
17

mastodon-java-api-example

Example Android app that uses Mastodon API via OAuth2
Java
3
star
18

zeon

Minimalist federated message board in Ruby
Ruby
3
star
19

colorless-chat

Web group chat
JavaScript
2
star
20

delight

Desktop client for Matrix
JavaScript
2
star
21

colorless-old

theColorless.net archive codebase
PHP
2
star
22

SaDOS

A guiding tutorial console in JavaScript
JavaScript
2
star
23

twittersphere

A thing that fetches user connections from Twitter and exports them to a GDF (directed graph file) that can be used e.g. in Gephi
Ruby
1
star
24

colorless-hotkeys

Navigation hotkeys for theColorless.net
JavaScript
1
star
25

doujinshi_txt

JavaScript
1
star
26

Colorchat

Ruby and EventMachine-based webchat application supporting WebSockets and a Comet fallback
Ruby
1
star