lib/blurhash.rb in blurhash-0.1.7 vs lib/blurhash.rb in blurhash-0.1.8
- old
+ new
@@ -3,9 +3,11 @@
require 'blurhash/version'
require 'blurhash_ext'
module Blurhash
def self.encode(width, height, pixels, x_comp: 4, y_comp: 3)
+ raise 'Pixels array has wrong size' if pixels.size != width * height * 3
+
p = pixels.pack("C#{pixels.size}")
return Unstable.blurHashForPixels(x_comp, y_comp, width, height, p)
end
def self.components(str)