blurhash_decoder 0.0.6 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +15 -0
- data/Rakefile +9 -0
- data/blurhash_decoder.gemspec +17 -0
- data/ext/blurhash_decoder/blurhash_decoder.c +205 -0
- data/ext/blurhash_decoder/stb_writer.h +1690 -0
- data/ext/blurhash_encoder/extconf.rb +6 -0
- data/lib/blurhash_decoder.rb +12 -4
- data/run.sh +4 -0
- metadata +12 -2
data/lib/blurhash_decoder.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "blurhash_decoder.bundle"
|
1
|
+
require "blurhash_decoder/blurhash_decoder"
|
2
|
+
require "blurhash_encoder/blurhash_encoder"
|
4
3
|
require 'base64'
|
4
|
+
require 'open-uri'
|
5
|
+
|
5
6
|
|
6
7
|
class BlurhashDecoder
|
7
8
|
include DECODER
|
9
|
+
#include ENCODER
|
8
10
|
VERSION = "1.0"
|
9
11
|
|
10
12
|
def decode_blurhash(blurhash, height, width, punch)
|
@@ -14,6 +16,12 @@ class BlurhashDecoder
|
|
14
16
|
end
|
15
17
|
base64_image
|
16
18
|
end
|
19
|
+
|
20
|
+
def blurhash(image_url)
|
21
|
+
File.write 'tmp/in.png', open(image_url).read
|
22
|
+
encode(4,3)
|
23
|
+
end
|
24
|
+
|
17
25
|
end
|
18
26
|
|
19
|
-
|
27
|
+
puts BlurhashDecoder.new.decode_blurhash("LEAclNah=_xC0K%LInWo9tE2jvNH", 2, 5, 1)
|
data/run.sh
ADDED
metadata
CHANGED
@@ -1,24 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blurhash_decoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rabin Poudyal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple blurhash decoder gem using c.
|
14
14
|
email: rabin@trip101.com
|
15
15
|
executables: []
|
16
16
|
extensions:
|
17
17
|
- ext/blurhash_decoder/extconf.rb
|
18
|
+
- ext/blurhash_encoder/extconf.rb
|
18
19
|
extra_rdoc_files: []
|
19
20
|
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- Gemfile
|
23
|
+
- Gemfile.lock
|
24
|
+
- Rakefile
|
25
|
+
- blurhash_decoder.gemspec
|
26
|
+
- ext/blurhash_decoder/blurhash_decoder.c
|
20
27
|
- ext/blurhash_decoder/extconf.rb
|
28
|
+
- ext/blurhash_decoder/stb_writer.h
|
29
|
+
- ext/blurhash_encoder/extconf.rb
|
21
30
|
- lib/blurhash_decoder.rb
|
31
|
+
- run.sh
|
22
32
|
homepage: https://rubygems.org/gems/blurhash_decoder
|
23
33
|
licenses:
|
24
34
|
- MIT
|