[luatex] Prevent stop when tiff file loads

Hans Hagen pragma at wxs.nl
Fri Jan 22 11:24:29 CET 2016


On 1/21/2016 10:10 PM, Patrick Gundlach wrote:
>>>
>>> Is there a way to prevent LuaTeX from stopping the whole process? Is there a function like
>>>
>>> can_you_handle_this_imagetype(filename="foo.tiff")
>>>
>>> ?
>>
>> local imgscan   = img.scan
>> local supported = { pdf = true, jpg = true, png = true }
>>
>> function img.scan(t)
>>     if t and t.filename then
>>         local e = string.match(t.filename,".-%.(.-)$")
>>         if supported[e] then
>>             return imgscan(t)
>>         end
>>     end
>> end
>>
>> local foo = img.scan({filename = "foo.tiff"})
>> local foo = img.scan({filename = "foo.pdf"})
>
>
> in my (real) case I don't have a file extension. I need to ask LuaTeX: do you understand that file format? I guess there is no way except for a fatal error, right?

previous mail : remove the GIF entry ... (not a native supported type in 
luatex)

btw, if you really want to be robust then you can probably best run a 
graphicmagick identify on the file because even if luatex can handle the 
file, it can still quit at some point because of an invalid image (and 
because when reading all kind of things happen luatex will quit simply 
because recovering is not possible) ... in the latest release all 
errors/warnings (when identified) are reported (lots of messages possible)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the luatex mailing list