[luatex] Prevent stop when tiff file loads

Hans Hagen pragma at wxs.nl
Thu Jan 21 21:46:04 CET 2016


On 1/21/2016 6:08 PM, Patrick Gundlach wrote:
> Hello all,
>
> I am using LuaTeX 0.79.1 and use
>
>      local foo = img.scan({filename = "foo.tiff"})
>
> but this fails with
>
> !LuaTeX error: internal error: unknown image type (2)
>   ==> Fatal error occurred, no output PDF file produced!
>
>
> 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"})




-----------------------------------------------------------------
                                           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