optimize image
This commit is contained in:
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
|
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:,
|
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!(
|
ActiveStorage::Attachment.create!(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(
|
blob: ActiveStorage::Blob.create_and_upload!(
|
||||||
@@ -100,7 +100,7 @@ module Templates
|
|||||||
bitdepth = 2**page.stats.to_a[1..3].pluck(2).uniq.size
|
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:,
|
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(
|
blob = ActiveStorage::Blob.new(
|
||||||
filename: "#{page_number}#{FORMAT}",
|
filename: "#{page_number}#{FORMAT}",
|
||||||
|
|||||||
Reference in New Issue
Block a user