blurhash_decoder 0.0.7 → 0.0.11
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/blurhash_encoder.c +52 -0
- data/ext/blurhash_encoder/common.h +26 -0
- data/ext/blurhash_encoder/encode.c +116 -0
- data/ext/blurhash_encoder/encode.h +9 -0
- data/ext/blurhash_encoder/extconf.rb +6 -0
- data/ext/blurhash_encoder/stb_image.h +7177 -0
- data/lib/blurhash_decoder/blurhash_decoder.bundle +0 -0
- data/lib/blurhash_decoder.rb +11 -3
- data/lib/blurhash_encoder/blurhash_encoder.bundle +0 -0
- data/lib/blurhash_encoder.rb +16 -0
- data/run.sh +4 -0
- metadata +19 -2
Binary file
|
data/lib/blurhash_decoder.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
$:.unshift File.dirname(__FILE__)
|
2
|
-
|
3
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)
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "blurhash_encoder/blurhash_encoder"
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
|
5
|
+
class BlurhashEncoder
|
6
|
+
include ENCODER
|
7
|
+
VERSION = "1.0"
|
8
|
+
|
9
|
+
def blurhash(image_url, x, y)
|
10
|
+
File.write 'tmp/in.png', URI.open(image_url).read
|
11
|
+
encode(x,y)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
# puts BlurhashEncoder.new.blurhash("http://m.gettywallpapers.com/wp-content/uploads/2021/06/Windows-11-Wallpaper.png", 4, 3)
|
data/run.sh
ADDED
metadata
CHANGED
@@ -1,25 +1,42 @@
|
|
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.11
|
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/blurhash_encoder.c
|
30
|
+
- ext/blurhash_encoder/common.h
|
31
|
+
- ext/blurhash_encoder/encode.c
|
32
|
+
- ext/blurhash_encoder/encode.h
|
33
|
+
- ext/blurhash_encoder/extconf.rb
|
34
|
+
- ext/blurhash_encoder/stb_image.h
|
21
35
|
- lib/blurhash_decoder.rb
|
22
36
|
- lib/blurhash_decoder/blurhash_decoder.bundle
|
37
|
+
- lib/blurhash_encoder.rb
|
38
|
+
- lib/blurhash_encoder/blurhash_encoder.bundle
|
39
|
+
- run.sh
|
23
40
|
homepage: https://rubygems.org/gems/blurhash_decoder
|
24
41
|
licenses:
|
25
42
|
- MIT
|