IIIF / image-validator

Validator for the Image API
http://iiif.io/api/image/validator/
Apache License 2.0
35 stars 20 forks source link

Unfairly failing the "Size specified by ,h" test? #102

Closed rafeili closed 6 months ago

rafeili commented 6 months ago

V2 validation example:

https://iiif.io/api/image/validator/results/?server=https%3A%2F%2Flbiiif.riksarkivet.se&prefix=%2Fv2%2F&identifier=arkis%2130002046_00022&version=2.0&level=1&id_basic=on&id_squares=on&info_json=on&id_error_escapedslash=on&id_error_random=on&id_error_unescaped=on&id_escaped=on&region_error_random=on&region_pixels=on&size_ch=on&size_error_random=on&size_percent=on&size_region=on&size_wc=on&rot_error_random=on&quality_error_random=on&format_jpg=on&format_error_random=on&baseurl_redirect=on&cors=on&jsonld=on

Image returned: https://lbiiif.riksarkivet.se/v2/arkis!30002046_00022/full/full/0/default.jpg

Fail for Size specified by ,h Elapsed time (ms): 1418

url: https://lbiiif.riksarkivet.se/v2/arkis!30002046_00022/full/,696/0/default.jpg got: Expected (696, 696) for size; Got: (864, 696) expected: No error type: General error message: Failed to check size due to: Expected (696, 696) for size; Got: (864, 696) warning: false

Size of 864 x 696 px is what we want to get as a response image size. Otherwise with a square value - like given in expected above - the image would get distorted (wrong aspect ratio).

Same sort of fail for V3:

https://iiif.io/api/image/validator/results/?server=https%3A%2F%2Flbiiif.riksarkivet.se&prefix=%2Fv3%2F&identifier=arkis%2130002046_00011&version=3.0&level=1&id_basic=on&id_squares=on&info_json=on&id_error_escapedslash=on&id_error_random=on&id_error_unescaped=on&id_escaped=on&region_error_random=on&region_pixels=on&size_nofull=on&region_square=on&size_ch=on&size_error_random=on&size_noup=on&size_region=on&size_wc=on&size_wh=on&rot_error_random=on&quality_error_random=on&format_jpg=on&format_error_random=on&baseurl_redirect=on&cors=on&jsonld=on

Image returned: https://lbiiif.riksarkivet.se/v3/arkis!30002046_00011/full/max/0/default.jpg

Fail for Size specified by ,h Elapsed time (ms): 853

url: https://lbiiif.riksarkivet.se/v3/arkis!30002046_00011/full/,508/0/default.jpg got: Expected (508, 508) for size; Got: (634, 508) expected: No error type: General error message: Failed to check size due to: Expected (508, 508) for size; Got: (634, 508) warning: false

Size of 634 x 508 px is what we want to get as a response image size. Otherwise with a square value - like given in expected above - the image would get distorted (wrong aspect ratio).

We need to assume that the test is unfairly failing.

Specification: Image API 2.0 https://iiif.io/api/image/2.0/#size

Form of size parameter: ,h | Description: The extracted region should be scaled so that its height is exactly equal to h, and the width will be a calculated value that maintains the aspect ratio of the extracted region.

Specification: Image API 3.0 https://iiif.io/api/image/3.0/#42-size

Form of size parameter: ,h | Description: The extracted region should be scaled so that the height of the returned image is exactly equal to h. The value of h must not be greater than the height of the extracted region.

glenrobson commented 6 months ago

See comment in https://github.com/IIIF/image-validator/issues/101#issuecomment-2047251440. The validator expects to see the test image which is square so it assumes the height and width will match.