add a test for unpremultiply
we actually test vipsthumbnail --linear on an RGBA image, which should catch everything, hopefully
This commit is contained in:
parent
d3ccadf212
commit
0b74acf7ba
@ -42,6 +42,8 @@ BMP_FILE = os.path.join(IMAGES, "MARBLES.BMP")
|
||||
NIFTI_FILE = os.path.join(IMAGES, "avg152T1_LR_nifti.nii.gz")
|
||||
ICO_FILE = os.path.join(IMAGES, "favicon.ico")
|
||||
HEIC_FILE = os.path.join(IMAGES, "heic-orientation-6.heic")
|
||||
RGBA_FILE = os.path.join(IMAGES, "rgba.png")
|
||||
RGBA_CORRECT_FILE = os.path.join(IMAGES, "rgba-correct.ppm")
|
||||
MOSAIC_FILES = [os.path.join(IMAGES, "cd1.1.jpg"), os.path.join(IMAGES, "cd1.2.jpg"),
|
||||
os.path.join(IMAGES, "cd2.1.jpg"), os.path.join(IMAGES, "cd2.2.jpg"),
|
||||
os.path.join(IMAGES, "cd3.1.jpg"), os.path.join(IMAGES, "cd3.2.jpg"),
|
||||
|
5
test/test-suite/images/rgba-correct.ppm
Normal file
5
test/test-suite/images/rgba-correct.ppm
Normal file
File diff suppressed because one or more lines are too long
BIN
test/test-suite/images/rgba.png
Normal file
BIN
test/test-suite/images/rgba.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
@ -2,7 +2,8 @@
|
||||
import pytest
|
||||
|
||||
import pyvips
|
||||
from helpers import JPEG_FILE, OME_FILE, HEIC_FILE, TIF_FILE, all_formats, have
|
||||
from helpers import JPEG_FILE, OME_FILE, HEIC_FILE, TIF_FILE, all_formats, \
|
||||
have, RGBA_FILE, RGBA_CORRECT_FILE
|
||||
|
||||
|
||||
# Run a function expecting a complex image on a two-band image
|
||||
@ -193,6 +194,11 @@ class TestResample:
|
||||
im2 = pyvips.Image.thumbnail_buffer(buf, 100)
|
||||
assert abs(im1.avg() - im2.avg()) < 1
|
||||
|
||||
# linear shrink should work on rgba images
|
||||
im1 = pyvips.Image.thumbnail(RGBA_FILE, 64, linear=True)
|
||||
im2 = pyvips.Image.new_from_file(RGBA_CORRECT_FILE)
|
||||
assert abs(im1.flatten(background=255).avg() - im2.avg()) < 1
|
||||
|
||||
if have("heifload"):
|
||||
# this image is orientation 6 ... thumbnail should flip it
|
||||
im = pyvips.Image.new_from_file(HEIC_FILE)
|
||||
|
Loading…
Reference in New Issue
Block a user