def test_converts_tif_to_lossy_jpeg2000(self): with temporary_folder() as output_folder: output_file = os.path.join(output_folder, 'output.jp2') get_kakadu().kdu_compress( filepaths.STANDARD_TIF, output_file, kakadu_options=kakadu.DEFAULT_COMPRESS_OPTIONS + kakadu.LOSSY_OPTIONS) assert os.path.isfile(output_file) validation.validate_jp2(output_file)
def validate_jp2_conversion(self, tiff_file, jp2_filepath, check_lossless=True): """ Validate the jp2 file using jpylyzer, and check that the conversion from tif to jp2 was lossless Raises a :class:`~image_processing.exceptions.ValidationError` if either check fails. :param tiff_file: :param jp2_filepath: :param check_lossless: if false, don't check the conversion from tif to jp2 was lossless """ validation.validate_jp2(jp2_filepath) if check_lossless: self.check_conversion_was_lossless(tiff_file, jp2_filepath)
def test_recognises_invalid_jpeg2000(self): with pytest.raises(exceptions.ValidationError): validation.validate_jp2(filepaths.INVALID_JP2)
def test_verifies_valid_lossy_jpeg2000(self): validation.validate_jp2(filepaths.LOSSY_JP2_FROM_STANDARD_TIF)
def test_verifies_valid_jpeg2000(self): validation.validate_jp2(filepaths.LOSSLESS_JP2_FROM_STANDARD_TIF_XMP)