From a7dd05fc8fa84aff1145d6c6f2502f7f45c534cb Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 24 Oct 2018 23:06:12 -0700 Subject: [PATCH] provide default import profile for vipsthumbnail --- app/logical/danbooru_image_resizer.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/logical/danbooru_image_resizer.rb b/app/logical/danbooru_image_resizer.rb index 20450b768..ecb4544a7 100644 --- a/app/logical/danbooru_image_resizer.rb +++ b/app/logical/danbooru_image_resizer.rb @@ -4,10 +4,10 @@ module DanbooruImageResizer # Taken from ArgyllCMS 2.0.0 (see also: https://ninedegreesbelow.com/photography/srgb-profile-comparison.html) SRGB_PROFILE = "#{Rails.root}/config/sRGB.icm" # http://jcupitt.github.io/libvips/API/current/libvips-resample.html#vips-thumbnail - THUMBNAIL_OPTIONS = { size: :down, linear: false, auto_rotate: false, export_profile: SRGB_PROFILE } + THUMBNAIL_OPTIONS = { size: :down, linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE } # http://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-jpegsave JPEG_OPTIONS = { background: 255, strip: true, interlace: true, optimize_coding: true } - CROP_OPTIONS = { linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, crop: :attention } + CROP_OPTIONS = { linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE, crop: :attention } # XXX libvips-8.4 on Debian doesn't support the `Vips::Image.thumbnail` method. # On 8.4 we have to shell out to vipsthumbnail instead. Remove when Debian supports 8.5. @@ -55,6 +55,7 @@ module DanbooruImageResizer arguments = [ file.path, "--eprofile=#{SRGB_PROFILE}", + "--iprofile=#{SRGB_PROFILE}", "--size=#{target_width}x#{target_height}", "--format=#{output_file.path}[Q=#{quality},background=255,strip,interlace,optimize_coding]" ] @@ -77,6 +78,7 @@ module DanbooruImageResizer arguments = [ file.path, "--eprofile=#{SRGB_PROFILE}", + "--iprofile=#{SRGB_PROFILE}", "--smartcrop=attention", "--size=#{width}x#{height}", "--format=#{output_file.path}[Q=#{quality},background=255,strip,interlace,optimize_coding]"