lib/cheesy-gallery/image_file.rb in cheesy-gallery-1.0.0 vs lib/cheesy-gallery/image_file.rb in cheesy-gallery-1.1.0
- old
+ new
@@ -38,9 +38,14 @@
sig { params(img: Magick::ImageList, path: String).void }
def process_and_write(img, path)
img.change_geometry!(@max_size) do |cols, rows, i|
i.resize!(cols, rows)
end
+ # follow recommendations from https://stackoverflow.com/a/7262050/4918 to get better compression
+ img.interlace = Magick::PlaneInterlace
+ # but skip the blur to avoid too many changes to the data
+ # img.gaussian_blur(0.05)
+ img.strip!
# workaround weird {self} initialisation pattern
quality = @quality
img.write(path) { self.quality = quality }
end
end