[Misc] Use libvips provided color profile

This commit is contained in:
Earlopain 2024-02-04 16:42:43 +01:00
parent f5fcd8a53b
commit 1a7df4a497
No known key found for this signature in database
GPG Key ID: 48860312319ADF61
2 changed files with 4 additions and 6 deletions

View File

@ -1,13 +1,11 @@
module DanbooruImageResizer
extend self
module_function
# Taken from ArgyllCMS 2.0.0 (see also: https://ninedegreesbelow.com/photography/srgb-profile-comparison.html)
SRGB_PROFILE = "#{Rails.root}/config/sRGB.icm"
# https://www.libvips.org/API/current/libvips-resample.html#vips-thumbnail
THUMBNAIL_OPTIONS = { size: :down, linear: false, no_rotate: true, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE }
THUMBNAIL_OPTIONS = { size: :down, linear: false, no_rotate: true, export_profile: "srgb", import_profile: "srgb" }.freeze
# https://www.libvips.org/API/current/VipsForeignSave.html#vips-jpegsave
JPEG_OPTIONS = { background: 0, strip: true, interlace: true, optimize_coding: true }
CROP_OPTIONS = { linear: false, no_rotate: true, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE, crop: :attention }
JPEG_OPTIONS = { background: 0, strip: true, interlace: true, optimize_coding: true }.freeze
CROP_OPTIONS = { linear: false, no_rotate: true, export_profile: "srgb", import_profile: "srgb", crop: :attention }.freeze
def resize(file, width, height, resize_quality = 90)
output_file = Tempfile.new

Binary file not shown.