Class: BlurhashDecoder
- Inherits:
-
Object
- Object
- BlurhashDecoder
- Includes:
- DECODER
- Defined in:
- lib/blurhash_decoder.rb
Constant Summary collapse
- VERSION =
include ENCODER
"1.0"
Instance Method Summary collapse
Methods included from DECODER
Instance Method Details
#blurhash(image_url) ⇒ Object
20 21 22 23 |
# File 'lib/blurhash_decoder.rb', line 20 def blurhash(image_url) File.write 'tmp/in.png', open(image_url).read encode(4,3) end |
#decode_blurhash(blurhash, height, width, punch) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/blurhash_decoder.rb', line 12 def decode_blurhash(blurhash, height, width, punch) decode(blurhash, height, width, punch) base64_image = File.open("tmp/out.png", "rb") do |file| Base64.strict_encode64(file.read) end base64_image end |