Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent width scaling #347

Open
kaspergrubbe opened this issue Aug 17, 2022 · 2 comments
Open

Inconsistent width scaling #347

kaspergrubbe opened this issue Aug 17, 2022 · 2 comments
Labels

Comments

@kaspergrubbe
Copy link

Describe the bug

When scaling images to 100x33 I get random results, I know it was already discussed here: #150, libvips/libvips#709 and libvips/libvips#1639 but maybe we should discuss if we can make it more consistent? It also seems like the behavior/math is different based on image type (in jpeg2000 case)?

When I scale with 100x I (for the most part) get 100x33 images, but when I scale with 100x33 I get 99x33 images, I guess users expect to get a 100x33 image when scaling to 100x33, I am aware of the hack described in #150 when width is more important than height:

vips_image.thumbnail_image(resize_args[:width].to_i, height: Vips::MAX_COORD)

But maybe there's a better fix?

The .jp2 (sorry for keep bothering you with jpeg2000 examples) scales differently than the others:

Vipsthumbnail 100x33: 100x33
Libvipsrb 100x33: 99x33

To Reproduce

Images and code is attached here: example-images-and-code.zip

ENV['VIPS_CONCURRENCY'] = '1'
ENV['VIPS_NOVECTOR'] = '1'
ENV['VIPS_INFO'] = '1'

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'ruby-vips', '2.1.4'
end

require 'vips'

def vips_to_file(target_file)
  puts "# #{target_file}"
  filesplit = target_file.split('.')
  vipsthumbnail_100x33_filename = "#{filesplit[0]}-vipsthumbnail-100x33.#{filesplit[1]}"
  vipsthumbnail_100x_filename = "#{filesplit[0]}-vipsthumbnail-100x.#{filesplit[1]}"
  libvipsrb_100x33_filename = "#{filesplit[0]}-libvipsrb-100x33.#{filesplit[1]}"
  libvipsrb_100x_filename = "#{filesplit[0]}-libvipsrb-100x.#{filesplit[1]}"

  puts ''
  puts '## vipsthumbnail 100x33'
  puts ''
  puts '```'
  system "vipsthumbnail #{target_file} --vips-info --size 100x33 -o #{vipsthumbnail_100x33_filename}"
  puts '```'
  puts ''

  puts ''
  puts '## vipsthumbnail 100x'
  puts ''
  puts '```'
  system "vipsthumbnail #{target_file} --vips-info --size 100x -o #{vipsthumbnail_100x_filename}"
  puts '```'
  puts ''

  puts '## libvips ruby 100x33'
  puts ''
  puts '```'
  vips_image = Vips::Image.new_from_file(target_file)
  vips_image = vips_image.thumbnail_image(100, height: 33)
  vips_image.write_to_file(libvipsrb_100x33_filename)
  puts '```'
  puts ''

  puts '## libvips ruby 100x'
  puts ''
  puts '```'
  vips_image = Vips::Image.new_from_file(target_file)
  vips_image = vips_image.thumbnail_image(100)
  vips_image.write_to_file(libvipsrb_100x_filename)
  puts '```'
  puts ''

  puts '## Results'
  puts ''
  vips_image = Vips::Image.new_from_file(vipsthumbnail_100x33_filename)
  puts "Vipsthumbnail 100x33: #{vips_image.width}x#{vips_image.height}"
  puts ''
  vips_image = Vips::Image.new_from_file(libvipsrb_100x33_filename)
  puts "Libvipsrb 100x33: #{vips_image.width}x#{vips_image.height}"
  puts ''
  vips_image = Vips::Image.new_from_file(vipsthumbnail_100x_filename)
  puts "Vipsthumbnail 100x: #{vips_image.width}x#{vips_image.height}"
  puts ''
  vips_image = Vips::Image.new_from_file(libvipsrb_100x_filename)
  puts "Libvipsrb 100x: #{vips_image.width}x#{vips_image.height}"
  puts ''
end

vips_to_file('coverimage.jp2')
vips_to_file('coverimage.jpeg')
vips_to_file('coverimage.jxl')
vips_to_file('coverimage.png')
vips_to_file('coverimage.tiff')
vips_to_file('coverimage.webp')

Result

coverimage.jp2

vipsthumbnail 100x33

VIPS-INFO: 10:21:39.961: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:39.961: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:39.961: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:39.961: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:39.961: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:39.962: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:39.962: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:39.964: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:39.970: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:39.981: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:39.985: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:39.988: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:39.995: thumbnailing coverimage.jp2
VIPS-INFO: 10:21:40.007: selected loader is VipsForeignLoadJp2kFile
VIPS-INFO: 10:21:40.007: input size is 1273 x 423
VIPS-INFO: 10:21:40.009: loading with factor 2 pre-shrink
VIPS-INFO: 10:21:40.011: pre-shrunk size is 319 x 106
VIPS-INFO: 10:21:40.011: converting to processing space srgb
VIPS-INFO: 10:21:40.011: premultiplying alpha
VIPS-INFO: 10:21:40.011: residual reducev by 0.311321
VIPS-INFO: 10:21:40.011: reducev: 21 point mask
VIPS-INFO: 10:21:40.011: reducev sequential line cache
VIPS-INFO: 10:21:40.011: residual reduceh by 0.311321
VIPS-INFO: 10:21:40.011: reduceh: 21 point mask
VIPS-INFO: 10:21:40.012: unpremultiplying alpha
VIPS-INFO: 10:21:40.012: converting to output space srgb
VIPS-INFO: 10:21:40.012: thumbnailing coverimage.jp2 as ./coverimage-vipsthumbnail-100x33.jp2

vipsthumbnail 100x

VIPS-INFO: 10:21:40.088: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.088: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.088: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.088: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.088: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.089: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:40.089: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:40.091: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:40.097: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:40.107: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:40.111: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:40.114: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:40.119: thumbnailing coverimage.jp2
VIPS-INFO: 10:21:40.124: selected loader is VipsForeignLoadJp2kFile
VIPS-INFO: 10:21:40.124: input size is 1273 x 423
VIPS-INFO: 10:21:40.126: loading with factor 2 pre-shrink
VIPS-INFO: 10:21:40.127: pre-shrunk size is 319 x 106
VIPS-INFO: 10:21:40.127: converting to processing space srgb
VIPS-INFO: 10:21:40.127: premultiplying alpha
VIPS-INFO: 10:21:40.127: residual reducev by 0.31348
VIPS-INFO: 10:21:40.127: reducev: 21 point mask
VIPS-INFO: 10:21:40.127: reducev sequential line cache
VIPS-INFO: 10:21:40.127: residual reduceh by 0.31348
VIPS-INFO: 10:21:40.128: reduceh: 21 point mask
VIPS-INFO: 10:21:40.128: unpremultiplying alpha
VIPS-INFO: 10:21:40.128: converting to output space srgb
VIPS-INFO: 10:21:40.128: thumbnailing coverimage.jp2 as ./coverimage-vipsthumbnail-100x.jp2

libvips ruby 100x33

VIPS-INFO: 10:21:40.162: selected loader is image source
VIPS-INFO: 10:21:40.162: input size is 1273 x 423
VIPS-INFO: 10:21:40.162: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:40.162: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:40.162: converting to processing space srgb
VIPS-INFO: 10:21:40.162: premultiplying alpha
VIPS-INFO: 10:21:40.162: residual reducev by 0.0780142
VIPS-INFO: 10:21:40.162: shrinkv by 6
VIPS-INFO: 10:21:40.162: reducev: 13 point mask
VIPS-INFO: 10:21:40.163: residual reduceh by 0.0780142
VIPS-INFO: 10:21:40.163: shrinkh by 6
VIPS-INFO: 10:21:40.163: reduceh: 13 point mask
VIPS-INFO: 10:21:40.163: unpremultiplying alpha
VIPS-INFO: 10:21:40.163: converting to output space srgb

libvips ruby 100x

VIPS-INFO: 10:21:40.343: selected loader is image source
VIPS-INFO: 10:21:40.343: input size is 1273 x 423
VIPS-INFO: 10:21:40.343: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:40.343: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:40.343: converting to processing space srgb
VIPS-INFO: 10:21:40.343: premultiplying alpha
VIPS-INFO: 10:21:40.343: residual reducev by 0.0785546
VIPS-INFO: 10:21:40.343: shrinkv by 6
VIPS-INFO: 10:21:40.343: reducev: 13 point mask
VIPS-INFO: 10:21:40.343: residual reduceh by 0.0785546
VIPS-INFO: 10:21:40.343: shrinkh by 6
VIPS-INFO: 10:21:40.343: reduceh: 13 point mask
VIPS-INFO: 10:21:40.343: unpremultiplying alpha
VIPS-INFO: 10:21:40.344: converting to output space srgb

Results

Vipsthumbnail 100x33: 99x33

Libvipsrb 100x33: 99x33

Vipsthumbnail 100x: 100x33

Libvipsrb 100x: 100x33

coverimage.jpeg

vipsthumbnail 100x33

VIPS-INFO: 10:21:40.552: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.552: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.552: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.552: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.552: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.553: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:40.553: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:40.555: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:40.561: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:40.571: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:40.576: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:40.579: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:40.585: thumbnailing coverimage.jpeg
VIPS-INFO: 10:21:40.592: selected loader is VipsForeignLoadJpegFile
VIPS-INFO: 10:21:40.592: input size is 1273 x 423
VIPS-INFO: 10:21:40.592: loading with factor 4 pre-shrink
VIPS-INFO: 10:21:40.593: pre-shrunk size is 318 x 105
VIPS-INFO: 10:21:40.593: converting to processing space srgb
VIPS-INFO: 10:21:40.593: residual reducev by 0.314286
VIPS-INFO: 10:21:40.593: reducev: 21 point mask
VIPS-INFO: 10:21:40.593: reducev sequential line cache
VIPS-INFO: 10:21:40.593: residual reduceh by 0.314286
VIPS-INFO: 10:21:40.594: reduceh: 21 point mask
VIPS-INFO: 10:21:40.594: converting to output space srgb
VIPS-INFO: 10:21:40.594: thumbnailing coverimage.jpeg as ./coverimage-vipsthumbnail-100x33.jpeg

vipsthumbnail 100x

VIPS-INFO: 10:21:40.654: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.655: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.655: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.655: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.655: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.655: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:40.656: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:40.657: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:40.663: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:40.674: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:40.678: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:40.681: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:40.686: thumbnailing coverimage.jpeg
VIPS-INFO: 10:21:40.690: selected loader is VipsForeignLoadJpegFile
VIPS-INFO: 10:21:40.690: input size is 1273 x 423
VIPS-INFO: 10:21:40.690: loading with factor 4 pre-shrink
VIPS-INFO: 10:21:40.691: pre-shrunk size is 318 x 105
VIPS-INFO: 10:21:40.691: converting to processing space srgb
VIPS-INFO: 10:21:40.691: residual reducev by 0.314465
VIPS-INFO: 10:21:40.691: reducev: 21 point mask
VIPS-INFO: 10:21:40.691: reducev sequential line cache
VIPS-INFO: 10:21:40.691: residual reduceh by 0.314465
VIPS-INFO: 10:21:40.691: reduceh: 21 point mask
VIPS-INFO: 10:21:40.692: converting to output space srgb
VIPS-INFO: 10:21:40.692: thumbnailing coverimage.jpeg as ./coverimage-vipsthumbnail-100x.jpeg

libvips ruby 100x33

VIPS-INFO: 10:21:40.701: selected loader is image source
VIPS-INFO: 10:21:40.701: input size is 1273 x 423
VIPS-INFO: 10:21:40.701: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:40.701: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:40.702: converting to processing space srgb
VIPS-INFO: 10:21:40.702: residual reducev by 0.0780142
VIPS-INFO: 10:21:40.702: shrinkv by 6
VIPS-INFO: 10:21:40.702: shrinkv sequential line cache
VIPS-INFO: 10:21:40.702: reducev: 13 point mask
VIPS-INFO: 10:21:40.702: reducev sequential line cache
VIPS-INFO: 10:21:40.702: residual reduceh by 0.0780142
VIPS-INFO: 10:21:40.702: shrinkh by 6
VIPS-INFO: 10:21:40.702: reduceh: 13 point mask
VIPS-INFO: 10:21:40.703: converting to output space srgb

libvips ruby 100x

VIPS-INFO: 10:21:40.727: selected loader is image source
VIPS-INFO: 10:21:40.727: input size is 1273 x 423
VIPS-INFO: 10:21:40.727: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:40.727: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:40.727: converting to processing space srgb
VIPS-INFO: 10:21:40.727: residual reducev by 0.0785546
VIPS-INFO: 10:21:40.727: shrinkv by 6
VIPS-INFO: 10:21:40.727: shrinkv sequential line cache
VIPS-INFO: 10:21:40.727: reducev: 13 point mask
VIPS-INFO: 10:21:40.727: reducev sequential line cache
VIPS-INFO: 10:21:40.727: residual reduceh by 0.0785546
VIPS-INFO: 10:21:40.727: shrinkh by 6
VIPS-INFO: 10:21:40.727: reduceh: 13 point mask
VIPS-INFO: 10:21:40.728: converting to output space srgb

Results

Vipsthumbnail 100x33: 100x33

Libvipsrb 100x33: 99x33

Vipsthumbnail 100x: 100x33

Libvipsrb 100x: 100x33

coverimage.jxl

vipsthumbnail 100x33

VIPS-INFO: 10:21:40.805: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.805: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.805: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.805: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.805: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.806: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:40.806: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:40.808: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:40.814: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:40.825: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:40.828: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:40.831: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:40.837: thumbnailing coverimage.jxl
VIPS-INFO: 10:21:40.867: selected loader is VipsForeignLoadJxlFile
VIPS-INFO: 10:21:40.868: input size is 1273 x 423
VIPS-INFO: 10:21:40.868: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:40.869: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:40.869: converting to processing space srgb
VIPS-INFO: 10:21:40.869: premultiplying alpha
VIPS-INFO: 10:21:40.869: residual reducev by 0.0780142
VIPS-INFO: 10:21:40.869: shrinkv by 6
VIPS-INFO: 10:21:40.869: shrinkv sequential line cache
VIPS-INFO: 10:21:40.869: reducev: 13 point mask
VIPS-INFO: 10:21:40.869: reducev sequential line cache
VIPS-INFO: 10:21:40.869: residual reduceh by 0.0780142
VIPS-INFO: 10:21:40.869: shrinkh by 6
VIPS-INFO: 10:21:40.869: reduceh: 13 point mask
VIPS-INFO: 10:21:40.870: unpremultiplying alpha
VIPS-INFO: 10:21:40.870: converting to output space srgb
VIPS-INFO: 10:21:40.870: thumbnailing coverimage.jxl as ./coverimage-vipsthumbnail-100x33.jxl

vipsthumbnail 100x

VIPS-INFO: 10:21:40.989: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.989: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.989: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.989: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:40.989: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:40.990: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:40.990: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:40.993: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:41.001: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:41.014: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:41.022: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:41.026: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:41.031: thumbnailing coverimage.jxl
VIPS-INFO: 10:21:41.052: selected loader is VipsForeignLoadJxlFile
VIPS-INFO: 10:21:41.052: input size is 1273 x 423
VIPS-INFO: 10:21:41.052: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.053: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.053: converting to processing space srgb
VIPS-INFO: 10:21:41.053: premultiplying alpha
VIPS-INFO: 10:21:41.053: residual reducev by 0.0785546
VIPS-INFO: 10:21:41.053: shrinkv by 6
VIPS-INFO: 10:21:41.053: shrinkv sequential line cache
VIPS-INFO: 10:21:41.053: reducev: 13 point mask
VIPS-INFO: 10:21:41.053: reducev sequential line cache
VIPS-INFO: 10:21:41.054: residual reduceh by 0.0785546
VIPS-INFO: 10:21:41.054: shrinkh by 6
VIPS-INFO: 10:21:41.054: reduceh: 13 point mask
VIPS-INFO: 10:21:41.054: unpremultiplying alpha
VIPS-INFO: 10:21:41.054: converting to output space srgb
VIPS-INFO: 10:21:41.054: thumbnailing coverimage.jxl as ./coverimage-vipsthumbnail-100x.jxl

libvips ruby 100x33

VIPS-INFO: 10:21:41.136: selected loader is image source
VIPS-INFO: 10:21:41.136: input size is 1273 x 423
VIPS-INFO: 10:21:41.136: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.136: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.136: converting to processing space srgb
VIPS-INFO: 10:21:41.136: premultiplying alpha
VIPS-INFO: 10:21:41.137: residual reducev by 0.0780142
VIPS-INFO: 10:21:41.137: shrinkv by 6
VIPS-INFO: 10:21:41.137: reducev: 13 point mask
VIPS-INFO: 10:21:41.137: residual reduceh by 0.0780142
VIPS-INFO: 10:21:41.137: shrinkh by 6
VIPS-INFO: 10:21:41.137: reduceh: 13 point mask
VIPS-INFO: 10:21:41.137: unpremultiplying alpha
VIPS-INFO: 10:21:41.138: converting to output space srgb

libvips ruby 100x

VIPS-INFO: 10:21:41.238: selected loader is image source
VIPS-INFO: 10:21:41.238: input size is 1273 x 423
VIPS-INFO: 10:21:41.238: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.238: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.238: converting to processing space srgb
VIPS-INFO: 10:21:41.238: premultiplying alpha
VIPS-INFO: 10:21:41.238: residual reducev by 0.0785546
VIPS-INFO: 10:21:41.238: shrinkv by 6
VIPS-INFO: 10:21:41.238: reducev: 13 point mask
VIPS-INFO: 10:21:41.238: residual reduceh by 0.0785546
VIPS-INFO: 10:21:41.238: shrinkh by 6
VIPS-INFO: 10:21:41.238: reduceh: 13 point mask
VIPS-INFO: 10:21:41.239: unpremultiplying alpha
VIPS-INFO: 10:21:41.239: converting to output space srgb

Results

Vipsthumbnail 100x33: 99x33

Libvipsrb 100x33: 99x33

Vipsthumbnail 100x: 100x33

Libvipsrb 100x: 100x33

coverimage.png

vipsthumbnail 100x33

VIPS-INFO: 10:21:41.351: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.351: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.351: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.351: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.351: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.352: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:41.352: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:41.354: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:41.360: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:41.373: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:41.377: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:41.380: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:41.386: thumbnailing coverimage.png
VIPS-INFO: 10:21:41.388: selected loader is VipsForeignLoadPngFile
VIPS-INFO: 10:21:41.388: input size is 1273 x 423
VIPS-INFO: 10:21:41.388: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.388: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.388: converting to processing space srgb
VIPS-INFO: 10:21:41.388: premultiplying alpha
VIPS-INFO: 10:21:41.389: residual reducev by 0.0780142
VIPS-INFO: 10:21:41.389: shrinkv by 6
VIPS-INFO: 10:21:41.389: shrinkv sequential line cache
VIPS-INFO: 10:21:41.389: reducev: 13 point mask
VIPS-INFO: 10:21:41.389: reducev sequential line cache
VIPS-INFO: 10:21:41.389: residual reduceh by 0.0780142
VIPS-INFO: 10:21:41.389: shrinkh by 6
VIPS-INFO: 10:21:41.389: reduceh: 13 point mask
VIPS-INFO: 10:21:41.390: unpremultiplying alpha
VIPS-INFO: 10:21:41.390: converting to output space srgb
VIPS-INFO: 10:21:41.390: thumbnailing coverimage.png as ./coverimage-vipsthumbnail-100x33.png

vipsthumbnail 100x

VIPS-INFO: 10:21:41.468: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.469: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.469: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.469: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.469: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.470: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:41.470: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:41.472: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:41.478: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:41.489: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:41.493: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:41.496: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:41.501: thumbnailing coverimage.png
VIPS-INFO: 10:21:41.502: selected loader is VipsForeignLoadPngFile
VIPS-INFO: 10:21:41.502: input size is 1273 x 423
VIPS-INFO: 10:21:41.502: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.502: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.502: converting to processing space srgb
VIPS-INFO: 10:21:41.502: premultiplying alpha
VIPS-INFO: 10:21:41.502: residual reducev by 0.0785546
VIPS-INFO: 10:21:41.502: shrinkv by 6
VIPS-INFO: 10:21:41.502: shrinkv sequential line cache
VIPS-INFO: 10:21:41.502: reducev: 13 point mask
VIPS-INFO: 10:21:41.502: reducev sequential line cache
VIPS-INFO: 10:21:41.503: residual reduceh by 0.0785546
VIPS-INFO: 10:21:41.503: shrinkh by 6
VIPS-INFO: 10:21:41.503: reduceh: 13 point mask
VIPS-INFO: 10:21:41.503: unpremultiplying alpha
VIPS-INFO: 10:21:41.503: converting to output space srgb
VIPS-INFO: 10:21:41.503: thumbnailing coverimage.png as ./coverimage-vipsthumbnail-100x.png

libvips ruby 100x33

VIPS-INFO: 10:21:41.536: selected loader is image source
VIPS-INFO: 10:21:41.536: input size is 1273 x 423
VIPS-INFO: 10:21:41.536: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.536: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.536: converting to processing space srgb
VIPS-INFO: 10:21:41.536: premultiplying alpha
VIPS-INFO: 10:21:41.536: residual reducev by 0.0780142
VIPS-INFO: 10:21:41.536: shrinkv by 6
VIPS-INFO: 10:21:41.536: shrinkv sequential line cache
VIPS-INFO: 10:21:41.536: reducev: 13 point mask
VIPS-INFO: 10:21:41.537: reducev sequential line cache
VIPS-INFO: 10:21:41.537: residual reduceh by 0.0780142
VIPS-INFO: 10:21:41.537: shrinkh by 6
VIPS-INFO: 10:21:41.537: reduceh: 13 point mask
VIPS-INFO: 10:21:41.538: unpremultiplying alpha
VIPS-INFO: 10:21:41.539: converting to output space srgb

libvips ruby 100x

VIPS-INFO: 10:21:41.580: selected loader is image source
VIPS-INFO: 10:21:41.580: input size is 1273 x 423
VIPS-INFO: 10:21:41.580: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.580: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.580: converting to processing space srgb
VIPS-INFO: 10:21:41.580: premultiplying alpha
VIPS-INFO: 10:21:41.580: residual reducev by 0.0785546
VIPS-INFO: 10:21:41.580: shrinkv by 6
VIPS-INFO: 10:21:41.580: shrinkv sequential line cache
VIPS-INFO: 10:21:41.580: reducev: 13 point mask
VIPS-INFO: 10:21:41.580: reducev sequential line cache
VIPS-INFO: 10:21:41.581: residual reduceh by 0.0785546
VIPS-INFO: 10:21:41.581: shrinkh by 6
VIPS-INFO: 10:21:41.581: reduceh: 13 point mask
VIPS-INFO: 10:21:41.582: unpremultiplying alpha
VIPS-INFO: 10:21:41.582: converting to output space srgb

Results

Vipsthumbnail 100x33: 99x33

Libvipsrb 100x33: 99x33

Vipsthumbnail 100x: 100x33

Libvipsrb 100x: 100x33

coverimage.tiff

vipsthumbnail 100x33

VIPS-INFO: 10:21:41.672: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.673: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.673: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.673: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.673: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.674: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:41.674: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:41.676: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:41.681: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:41.692: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:41.696: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:41.699: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:41.704: thumbnailing coverimage.tiff
VIPS-INFO: 10:21:41.712: selected loader is VipsForeignLoadTiffFile
VIPS-INFO: 10:21:41.712: input size is 1273 x 423
VIPS-INFO: 10:21:41.712: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.713: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.713: converting to processing space srgb
VIPS-INFO: 10:21:41.713: premultiplying alpha
VIPS-INFO: 10:21:41.713: residual reducev by 0.0780142
VIPS-INFO: 10:21:41.713: shrinkv by 6
VIPS-INFO: 10:21:41.714: shrinkv sequential line cache
VIPS-INFO: 10:21:41.714: reducev: 13 point mask
VIPS-INFO: 10:21:41.714: reducev sequential line cache
VIPS-INFO: 10:21:41.714: residual reduceh by 0.0780142
VIPS-INFO: 10:21:41.714: shrinkh by 6
VIPS-INFO: 10:21:41.714: reduceh: 13 point mask
VIPS-INFO: 10:21:41.714: unpremultiplying alpha
VIPS-INFO: 10:21:41.714: converting to output space srgb
VIPS-INFO: 10:21:41.714: thumbnailing coverimage.tiff as ./coverimage-vipsthumbnail-100x33.tiff

vipsthumbnail 100x

VIPS-INFO: 10:21:41.802: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.803: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.803: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.803: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:41.803: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:41.804: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:41.804: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:41.806: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:41.813: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:41.827: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:41.831: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:41.834: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:41.841: thumbnailing coverimage.tiff
VIPS-INFO: 10:21:41.845: selected loader is VipsForeignLoadTiffFile
VIPS-INFO: 10:21:41.845: input size is 1273 x 423
VIPS-INFO: 10:21:41.845: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.846: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.846: converting to processing space srgb
VIPS-INFO: 10:21:41.846: premultiplying alpha
VIPS-INFO: 10:21:41.846: residual reducev by 0.0785546
VIPS-INFO: 10:21:41.846: shrinkv by 6
VIPS-INFO: 10:21:41.847: shrinkv sequential line cache
VIPS-INFO: 10:21:41.847: reducev: 13 point mask
VIPS-INFO: 10:21:41.847: reducev sequential line cache
VIPS-INFO: 10:21:41.847: residual reduceh by 0.0785546
VIPS-INFO: 10:21:41.847: shrinkh by 6
VIPS-INFO: 10:21:41.847: reduceh: 13 point mask
VIPS-INFO: 10:21:41.847: unpremultiplying alpha
VIPS-INFO: 10:21:41.847: converting to output space srgb
VIPS-INFO: 10:21:41.847: thumbnailing coverimage.tiff as ./coverimage-vipsthumbnail-100x.tiff

libvips ruby 100x33

VIPS-INFO: 10:21:41.891: selected loader is image source
VIPS-INFO: 10:21:41.891: input size is 1273 x 423
VIPS-INFO: 10:21:41.891: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.891: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.891: converting to processing space srgb
VIPS-INFO: 10:21:41.891: premultiplying alpha
VIPS-INFO: 10:21:41.891: residual reducev by 0.0780142
VIPS-INFO: 10:21:41.891: shrinkv by 6
VIPS-INFO: 10:21:41.892: shrinkv sequential line cache
VIPS-INFO: 10:21:41.892: reducev: 13 point mask
VIPS-INFO: 10:21:41.892: reducev sequential line cache
VIPS-INFO: 10:21:41.893: residual reduceh by 0.0780142
VIPS-INFO: 10:21:41.893: shrinkh by 6
VIPS-INFO: 10:21:41.893: reduceh: 13 point mask
VIPS-INFO: 10:21:41.894: unpremultiplying alpha
VIPS-INFO: 10:21:41.894: converting to output space srgb

libvips ruby 100x

VIPS-INFO: 10:21:41.936: selected loader is image source
VIPS-INFO: 10:21:41.936: input size is 1273 x 423
VIPS-INFO: 10:21:41.936: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:41.936: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:41.936: converting to processing space srgb
VIPS-INFO: 10:21:41.936: premultiplying alpha
VIPS-INFO: 10:21:41.936: residual reducev by 0.0785546
VIPS-INFO: 10:21:41.936: shrinkv by 6
VIPS-INFO: 10:21:41.936: shrinkv sequential line cache
VIPS-INFO: 10:21:41.937: reducev: 13 point mask
VIPS-INFO: 10:21:41.937: reducev sequential line cache
VIPS-INFO: 10:21:41.937: residual reduceh by 0.0785546
VIPS-INFO: 10:21:41.937: shrinkh by 6
VIPS-INFO: 10:21:41.938: reduceh: 13 point mask
VIPS-INFO: 10:21:41.938: unpremultiplying alpha
VIPS-INFO: 10:21:41.938: converting to output space srgb

Results

Vipsthumbnail 100x33: 99x33

Libvipsrb 100x33: 99x33

Vipsthumbnail 100x: 100x33

Libvipsrb 100x: 100x33

coverimage.webp

vipsthumbnail 100x33

VIPS-INFO: 10:21:42.035: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:42.036: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:42.036: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:42.036: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:42.036: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:42.037: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:42.037: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:42.039: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:42.047: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:42.063: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:42.067: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:42.070: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:42.075: thumbnailing coverimage.webp
VIPS-INFO: 10:21:42.077: selected loader is VipsForeignLoadWebpFile
VIPS-INFO: 10:21:42.077: input size is 1273 x 423
VIPS-INFO: 10:21:42.077: loading with factor 12.8182 pre-shrink
VIPS-INFO: 10:21:42.077: pre-shrunk size is 99 x 33
VIPS-INFO: 10:21:42.077: converting to processing space srgb
VIPS-INFO: 10:21:42.078: converting to output space srgb
VIPS-INFO: 10:21:42.078: thumbnailing coverimage.webp as ./coverimage-vipsthumbnail-100x33.webp

vipsthumbnail 100x

VIPS-INFO: 10:21:42.138: VIPSHOME = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:42.138: VIPS_PREFIX = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:42.138: VIPS_LIBDIR = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:42.138: prefix = /usr/local/Cellar/vips/8.13.0
VIPS-INFO: 10:21:42.138: libdir = /usr/local/Cellar/vips/8.13.0/lib
VIPS-INFO: 10:21:42.140: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13"
VIPS-INFO: 10:21:42.140: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-jxl.so"
VIPS-INFO: 10:21:42.142: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-poppler.so"
VIPS-INFO: 10:21:42.147: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-heif.so"
VIPS-INFO: 10:21:42.158: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-openslide.so"
VIPS-INFO: 10:21:42.162: loading "/usr/local/Cellar/vips/8.13.0/lib/vips-modules-8.13/vips-magick.so"
VIPS-INFO: 10:21:42.165: searching "/usr/local/Cellar/vips/8.13.0/lib/vips-plugins-8.13"
VIPS-INFO: 10:21:42.170: thumbnailing coverimage.webp
VIPS-INFO: 10:21:42.170: selected loader is VipsForeignLoadWebpFile
VIPS-INFO: 10:21:42.170: input size is 1273 x 423
VIPS-INFO: 10:21:42.170: loading with factor 12.73 pre-shrink
VIPS-INFO: 10:21:42.171: pre-shrunk size is 100 x 33
VIPS-INFO: 10:21:42.171: converting to processing space srgb
VIPS-INFO: 10:21:42.171: converting to output space srgb
VIPS-INFO: 10:21:42.171: thumbnailing coverimage.webp as ./coverimage-vipsthumbnail-100x.webp

libvips ruby 100x33

VIPS-INFO: 10:21:42.187: selected loader is image source
VIPS-INFO: 10:21:42.187: input size is 1273 x 423
VIPS-INFO: 10:21:42.187: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:42.187: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:42.187: converting to processing space srgb
VIPS-INFO: 10:21:42.188: residual reducev by 0.0780142
VIPS-INFO: 10:21:42.188: shrinkv by 6
VIPS-INFO: 10:21:42.188: reducev: 13 point mask
VIPS-INFO: 10:21:42.188: residual reduceh by 0.0780142
VIPS-INFO: 10:21:42.188: shrinkh by 6
VIPS-INFO: 10:21:42.188: reduceh: 13 point mask
VIPS-INFO: 10:21:42.188: converting to output space srgb

libvips ruby 100x

VIPS-INFO: 10:21:42.233: selected loader is image source
VIPS-INFO: 10:21:42.233: input size is 1273 x 423
VIPS-INFO: 10:21:42.233: loading with factor 1 pre-shrink
VIPS-INFO: 10:21:42.233: pre-shrunk size is 1273 x 423
VIPS-INFO: 10:21:42.234: converting to processing space srgb
VIPS-INFO: 10:21:42.234: residual reducev by 0.0785546
VIPS-INFO: 10:21:42.234: shrinkv by 6
VIPS-INFO: 10:21:42.234: reducev: 13 point mask
VIPS-INFO: 10:21:42.234: residual reduceh by 0.0785546
VIPS-INFO: 10:21:42.234: shrinkh by 6
VIPS-INFO: 10:21:42.234: reduceh: 13 point mask
VIPS-INFO: 10:21:42.235: converting to output space srgb

Results

Vipsthumbnail 100x33: 99x33

Libvipsrb 100x33: 99x33

Vipsthumbnail 100x: 100x33

Libvipsrb 100x: 100x33

@jcupitt
Copy link
Member

jcupitt commented Aug 17, 2022

Hi, I'll have a look.

I expect you saw you can use --force to make it break aspect ratio. It might fix your immediate problem.

@jcupitt
Copy link
Member

jcupitt commented Aug 17, 2022

I think this is down to differences in shrink on load behaviour between the file format libraries.

Your ruby code is using thumbnail_image, which does not use any shrink on load tricks (and can be very slow as a result). libjpeg shrink-on-load always rounds down, but libwebp shrink on load does round to nearest.

I'm not sure what we could do to make it more consistent. We use libwebp shrink-on-load for the whole shrink at the moment. Perhaps we should leave the final 200% to libvips? I expect you could still find corner cases where dimensions were different though.

I suppose thumbnail could also do a non-rectangular final stage to ensure we always hit consistent dimensions, but that would mean slightly non-rectangular pixels, which I would hate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants