Elektrine lite

← Feed

@risc@wetdry.world

Post #2624514

2026-05-13 15:24 UTC

@argv_minus_one@mastodon.sdf.org ugh. was unaware of the patent bullshit.. from my memory: Mastodon re-encodes images, but keeps them in the same format as uploaded (so, for lossy formats, making efforts to encode more efficiently worthless), unless the format is not allowed (like AVIF) - in which case it's encoded to JPEG from checking the code: 1 - this (lib/paperclip/vips_lazy_thumbnail.rb) decides when to convert (with libvips) an image, which seems to mean re-encoding it def needs_convert? strip_animations? || needs_different_geometry? || needs_different_format? || needs_metadata_stripping? end 2 - this (app/models/media_attachment.rb) specifies which image MIME types are supported and which will be converted (hence, JPEG, PNG, GIF, WebP can stay, but will be re-encoded anyway if needed to strip metadata it seems - it seems to be the same path): IMAGE_MIME_TYPES = %w(image/jpeg image/png image/gif image/heic image/heif image/webp image/avif).freeze IMAGE_CONVERTIBLE_MIME_TYPES = %w(image/heic image/heif image/avif).freeze to JPEG: IMAGE_CONVERTED_STYLES = { original: { format: 'jpeg', content_type: 'image/jpeg', }.merge(IMAGE_STYLES[:original]).freeze, small: { format: 'jpeg', }.merge(IMAGE_STYLES[:small]).freeze, }.freeze seemingly at Q=90 (both for native JPEG and previously-AVIF/HEIC/HEIF): def save_options case @format when 'jpg' { Q: 90, interlace: true } else {} end end ugh. the Markdown rendering broke and i'm not sure why it was the list @soft@normal.style

Replies (0)

No replies.