"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/test-suite/test_resample.py" between
vips-8.10.6.tar.gz and vips-8.11.0.tar.gz

About: VIPS is a free image processing system (see also the GUI nip2).

test_resample.py  (vips-8.10.6):test_resample.py  (vips-8.11.0)
# vim: set fileencoding=utf-8 : # vim: set fileencoding=utf-8 :
import pytest import pytest
import pyvips import pyvips
from helpers import JPEG_FILE, OME_FILE, HEIC_FILE, TIF_FILE, all_formats, \ from helpers import JPEG_FILE, OME_FILE, HEIC_FILE, TIF_FILE, all_formats, \
have, RGBA_FILE, RGBA_CORRECT_FILE have, RGBA_FILE, RGBA_CORRECT_FILE, AVIF_FILE
# Run a function expecting a complex image on a two-band image # Run a function expecting a complex image on a two-band image
def run_cmplx(fn, image): def run_cmplx(fn, image):
if image.format == pyvips.BandFormat.FLOAT: if image.format == pyvips.BandFormat.FLOAT:
new_format = pyvips.BandFormat.COMPLEX new_format = pyvips.BandFormat.COMPLEX
elif image.format == pyvips.BandFormat.DOUBLE: elif image.format == pyvips.BandFormat.DOUBLE:
new_format = pyvips.BandFormat.DPCOMPLEX new_format = pyvips.BandFormat.DPCOMPLEX
else: else:
raise pyvips.Error("run_cmplx: not float or double") raise pyvips.Error("run_cmplx: not float or double")
skipping to change at line 200 skipping to change at line 200
im2 = pyvips.Image.thumbnail_buffer(buf, 100) im2 = pyvips.Image.thumbnail_buffer(buf, 100)
assert abs(im1.avg() - im2.avg()) < 1 assert abs(im1.avg() - im2.avg()) < 1
# linear shrink should work on rgba images # linear shrink should work on rgba images
im1 = pyvips.Image.thumbnail(RGBA_FILE, 64, linear=True) im1 = pyvips.Image.thumbnail(RGBA_FILE, 64, linear=True)
im2 = pyvips.Image.new_from_file(RGBA_CORRECT_FILE) im2 = pyvips.Image.new_from_file(RGBA_CORRECT_FILE)
assert abs(im1.flatten(background=255).avg() - im2.avg()) < 1 assert abs(im1.flatten(background=255).avg() - im2.avg()) < 1
if have("heifload"): if have("heifload"):
# this image is orientation 6 ... thumbnail should flip it # this image is orientation 6 ... thumbnail should flip it
im = pyvips.Image.new_from_file(HEIC_FILE) im = pyvips.Image.new_from_file(AVIF_FILE)
thumb = pyvips.Image.thumbnail(HEIC_FILE, 100) thumb = pyvips.Image.thumbnail(AVIF_FILE, 100)
# thumb should be portrait # thumb should be portrait
assert thumb.width < thumb.height assert thumb.width < thumb.height
assert thumb.height == 100 assert thumb.height == 100
def test_similarity(self): def test_similarity(self):
im = pyvips.Image.new_from_file(JPEG_FILE) im = pyvips.Image.new_from_file(JPEG_FILE)
im2 = im.similarity(angle=90) im2 = im.similarity(angle=90)
im3 = im.affine([0, -1, 1, 0]) im3 = im.affine([0, -1, 1, 0])
# rounding in calculating the affine transform from the angle stops # rounding in calculating the affine transform from the angle stops
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)