optimize image blank

This commit is contained in:
Pete Matsyburka
2025-07-02 13:16:47 +03:00
parent eef2d9d599
commit 91df5b2407
+4 -2
View File
@@ -4,8 +4,10 @@ module ImageUtils
module_function
def blank?(image)
min = (0...image.bands).map { |i| image.stats.getpoint(0, i)[0] }
max = (0...image.bands).map { |i| image.stats.getpoint(1, i)[0] }
stats = image.stats
min = (0...image.bands).map { |i| stats.getpoint(0, i)[0] }
max = (0...image.bands).map { |i| stats.getpoint(1, i)[0] }
return true if min.all?(255) && max.all?(255)
return true if min.all?(0) && max.all?(0)