adjust autorot

This commit is contained in:
Pete Matsyburka
2026-05-23 09:30:56 +03:00
parent d44b35cf0a
commit 89bf83febb
5 changed files with 16 additions and 12 deletions
+2 -2
View File
@@ -58,13 +58,13 @@ module Templates
def generate_preview_image(attachment, data)
ActiveStorage::Attachment.where(name: ATTACHMENT_NAME, record: attachment).destroy_all
image = ImageUtils.load_vips(data, content_type: attachment.content_type).autorot
image = ImageUtils.load_vips(data, content_type: attachment.content_type, autorot: true)
image = image.resize(MAX_WIDTH / image.width.to_f)
bitdepth = 2**image.stats.to_a[1..3].pluck(2).uniq.size
io = StringIO.new(image.write_to_buffer(FORMAT, compression: 6, filter: 0, bitdepth:,
palette: true, Q: Q, dither: 0))
palette: true, Q: Q, dither: 0, strip: true))
ActiveStorage::Attachment.create!(
blob: ActiveStorage::Blob.create_and_upload!(