optimize image

pull/381/head
Pete Matsyburka 1 year ago committed by Oleksandr Turchyn
parent 571f5d8221
commit 5dd59f4f7c

@ -44,7 +44,7 @@ module Templates
bitdepth = 2**image.stats.to_a[1..3].pluck(2).uniq.size
io = StringIO.new(image.write_to_buffer(FORMAT, compression: 7, filter: 0, bitdepth:,
palette: true, Q: Q, dither: 0))
palette: true, Q: bitdepth == 8 ? Q : 5, dither: 0))
ActiveStorage::Attachment.create!(
blob: ActiveStorage::Blob.create_and_upload!(
@ -100,7 +100,7 @@ module Templates
bitdepth = 2**page.stats.to_a[1..3].pluck(2).uniq.size
io = StringIO.new(page.write_to_buffer(FORMAT, compression: 7, filter: 0, bitdepth:,
palette: true, Q: Q, dither: 0))
palette: true, Q: bitdepth == 8 ? Q : 5, dither: 0))
blob = ActiveStorage::Blob.new(
filename: "#{page_number}#{FORMAT}",

Loading…
Cancel
Save