Skip to content

Vips::Image.thumbnail and Vips::Image.thumbnail_image resize to height instead of width when no hash options are present  #408

@i-h8-github

Description

@i-h8-github

Bug report

Describe the bug
Vips::Image.thumbnail and Vips::Image.thumbnail_image resize to height instead of width when no hash options are present. If a :height is also supplied, they will resize to the expected width

To Reproduce

img = Vips::Image.new_from_file "file.pdf"
puts "#{img.width}, #{img.height}" # 612, 859
thumb = img.thumbnail_image 200
puts "#{thumb.width}, #{thumb.height}" # 142, 200
thumb = img.thumbnail_image 200, :height => 1000
puts "#{thumb.width}, #{thumb.height}" # 200, 281

thumb = Vips::Image.thumbnail "file.pdf", 200
puts "#{thumb.width}, #{thumb.height}" # 143, 200 — Different height from above for some reason
thumb = Vips::Image.thumbnail "file.pdf", 200, :height => 1000
puts "#{thumb.width}, #{thumb.height}" # 200, 281

Expected behavior
Should resize to specified width as described

Actual behavior
Resizes to a height of the specified width

Environment

  • OS: Ubuntu 24.04
  • Vips: 8.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions