`thumbnail(crop=ALL)` returns a cropped image instead of the full resized image in 8.19

オープン 初心者向け
#5,366 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c

調査の方向性

まず、#5088で導入された新しいクロップ処理を読み、特に vips_smartcrop() の後に vips_thumbnail_crop_pages() を呼び出す箇所を確認してください。VIPS_INTERESTING_ALL の処理を確認し、320x240にリサイズされ、目標サイズが320x180の400x300入力に対する回帰テストを追加してください。このテストでは、crop=ALL がリサイズ後の画像全体を保持することを確認します。

索引モデルが issue の本文から書いたものです。

説明

bug

In 8.19, vips_thumbnail() with crop=VIPS_INTERESTING_ALL now returns a width x height top-left crop of the resized image, instead of the full resized image. This is a possible regression introduced by #5088 (commit 916b968bd993c7f93a4474486bfd5c57995309de): the new code always re-crops to crop_width x crop_height, even though vips_smartcrop() treats VIPS_INTERESTING_ALL as the whole image. Previously, ALL meant "resize to cover the target box, but do not crop", allowing callers to choose the crop window afterwards.

Reproduction:

vips black in.png 400 300
vips thumbnail in.png out.png 320 --height 180 --size both --crop all
vipsheader -f width out.png && vipsheader -f height out.png

In 8.18.8 this produces 320x240 (the full resized image); in 8.19.0 it produces 320x180 (only the top-left crop). The extra content needed by callers is discarded.

A possible fix is to special-case VIPS_INTERESTING_ALL in the new crop path and skip the final vips_thumbnail_crop_pages() step, keeping the full resized image as before. A regression test could check that a 400x300 input with crop=ALL at 320x180 produces 320x240, not 320x180.

主要言語
C
スター
11.9k
フォーク
811
平均マージ
1日 6時間
マージ済み PR(30日)
44

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

libvips/libvips のほかの issue

libvips/libvips の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。