Don't try to run jbig2 when not available
This commit is contained in:
@@ -133,7 +133,7 @@ def extract_image(*, doc, pike, root, log, image, xref, jbig2s,
|
||||
return False
|
||||
filtdp = filtdps[0]
|
||||
|
||||
if bpc == 1 and filtdp[0] != '/JBIG2Decode':
|
||||
if bpc == 1 and filtdp[0] != '/JBIG2Decode' and jbig2enc.available():
|
||||
if filtdp[0] == '/CCITTFaxDecode':
|
||||
data = image.read_raw_bytes()
|
||||
try:
|
||||
|
||||
@@ -22,7 +22,7 @@ import os
|
||||
import shutil
|
||||
|
||||
from . import get_version
|
||||
from ..exceptions import ExitCode
|
||||
from ..exceptions import ExitCode, MissingDependencyError
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
@@ -30,6 +30,15 @@ def version():
|
||||
return get_version('jbig2enc', regex=r'jbig2enc (\d+(\.\d+)*).*')
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def available():
|
||||
try:
|
||||
version()
|
||||
except MissingDependencyError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def convert_group(*, cwd, infiles, out_prefix):
|
||||
args = [
|
||||
'jbig2',
|
||||
|
||||
Reference in New Issue
Block a user