provide default import profile for vipsthumbnail
This commit is contained in:
@@ -4,10 +4,10 @@ module DanbooruImageResizer
|
|||||||
# Taken from ArgyllCMS 2.0.0 (see also: https://ninedegreesbelow.com/photography/srgb-profile-comparison.html)
|
# Taken from ArgyllCMS 2.0.0 (see also: https://ninedegreesbelow.com/photography/srgb-profile-comparison.html)
|
||||||
SRGB_PROFILE = "#{Rails.root}/config/sRGB.icm"
|
SRGB_PROFILE = "#{Rails.root}/config/sRGB.icm"
|
||||||
# http://jcupitt.github.io/libvips/API/current/libvips-resample.html#vips-thumbnail
|
# 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
|
# http://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-jpegsave
|
||||||
JPEG_OPTIONS = { background: 255, strip: true, interlace: true, optimize_coding: true }
|
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.
|
# 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.
|
# On 8.4 we have to shell out to vipsthumbnail instead. Remove when Debian supports 8.5.
|
||||||
@@ -55,6 +55,7 @@ module DanbooruImageResizer
|
|||||||
arguments = [
|
arguments = [
|
||||||
file.path,
|
file.path,
|
||||||
"--eprofile=#{SRGB_PROFILE}",
|
"--eprofile=#{SRGB_PROFILE}",
|
||||||
|
"--iprofile=#{SRGB_PROFILE}",
|
||||||
"--size=#{target_width}x#{target_height}",
|
"--size=#{target_width}x#{target_height}",
|
||||||
"--format=#{output_file.path}[Q=#{quality},background=255,strip,interlace,optimize_coding]"
|
"--format=#{output_file.path}[Q=#{quality},background=255,strip,interlace,optimize_coding]"
|
||||||
]
|
]
|
||||||
@@ -77,6 +78,7 @@ module DanbooruImageResizer
|
|||||||
arguments = [
|
arguments = [
|
||||||
file.path,
|
file.path,
|
||||||
"--eprofile=#{SRGB_PROFILE}",
|
"--eprofile=#{SRGB_PROFILE}",
|
||||||
|
"--iprofile=#{SRGB_PROFILE}",
|
||||||
"--smartcrop=attention",
|
"--smartcrop=attention",
|
||||||
"--size=#{width}x#{height}",
|
"--size=#{width}x#{height}",
|
||||||
"--format=#{output_file.path}[Q=#{quality},background=255,strip,interlace,optimize_coding]"
|
"--format=#{output_file.path}[Q=#{quality},background=255,strip,interlace,optimize_coding]"
|
||||||
|
|||||||
Reference in New Issue
Block a user