Use -auto-orient rather than -flip
@@ -39,36 +39,6 @@ import testlib.misc as misc
CONVERT_BINARY = ["convert"]
-g_ConvertVersion = None
-
-
-def get_convert_version():
- """
- Get the major/minor version of ImageMagick on the system.
- """
- global g_ConvertVersion
-
- if g_ConvertVersion is None:
- command = list(CONVERT_BINARY)
- command += ["--version"]
- result = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE,
- check=True, encoding="utf-8")
-
- # Version is top row
- version = result.stdout.splitlines()[0]
- # ... third token
- version = re.split(" ", version)[2]
- # ... major/minor/patch/subpatch
- version = re.split("\\.|-", version)
-
- numericVersion = float(version[0])
- numericVersion += float(version[1]) / 10.0
-
- g_ConvertVersion = numericVersion
-
- return g_ConvertVersion
-
-
class ImageException(Exception):
"""
Exception thrown for bad image specification.
@@ -262,14 +232,6 @@ class Image():
Args:
filePath (str): The path to the image on disk.
"""
- convert = get_convert_version()
-
- # ImageMagick 7 started to use .tga file origin information. By default
- # TGA files store data from bottom up, and define the origin as bottom
- # left. We want our color samples to always use a top left origin, even
- # if the data is stored in alternative layout.
- self.invertYCoords = (convert >= 7.0) and filePath.endswith(".tga")
-
self.filePath = filePath
self.proxyPath = None
@@ -301,9 +263,8 @@ class Image():
command = list(CONVERT_BINARY)
command += [self.filePath]
- # Invert coordinates if the format needs it
- if self.invertYCoords:
- command += ["-flip"]
+ # Ensure convert factors in format origin if needed
+ command += ["-auto-orient"]
command += [
"-format", "%%[pixel:p{%u,%u}]" % (x, y),
