HiDPI image patch

local
Thor 2 years ago
parent f487fe0951
commit d4219bd203
  1. 3
      app/javascript/flavours/glitch/util/resize_image.js
  2. 3
      app/javascript/mastodon/utils/resize_image.js
  3. 8
      app/models/media_attachment.rb

@ -1,6 +1,7 @@
import EXIF from 'exif-js';
const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
//const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
const MAX_IMAGE_PIXELS = 8294400; // 3840x2160px (HiDPI patch)
const _browser_quirks = {};

@ -1,6 +1,7 @@
import EXIF from 'exif-js';
const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
//const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
const MAX_IMAGE_PIXELS = 8294400; // 3840x2160px (HiDPI patch)
const _browser_quirks = {};

@ -67,12 +67,14 @@ class MediaAttachment < ApplicationRecord
IMAGE_STYLES = {
original: {
pixels: 2_073_600, # 1920x1080px
# pixels: 2_073_600, # 1920x1080px
pixels: 8_294_400, # 3840x2160px (HiDPI patch)
file_geometry_parser: FastGeometryParser,
}.freeze,
small: {
pixels: 160_000, # 400x400px
# pixels: 160_000, # 400x400px
pixels: 640_000, # 800x800px (HiDPI patch)
file_geometry_parser: FastGeometryParser,
blurhash: BLURHASH_OPTIONS,
}.freeze,
@ -121,7 +123,7 @@ class MediaAttachment < ApplicationRecord
convert_options: {
output: {
'loglevel' => 'fatal',
vf: 'scale=\'min(400\, iw):min(400\, ih)\':force_original_aspect_ratio=decrease',
vf: 'scale=\'min(800\, iw):min(800\, ih)\':force_original_aspect_ratio=decrease',
}.freeze,
}.freeze,
format: 'png',

Loading…
Cancel
Save