Re: [NTG-context] Use figures without file extension

On Sun, 27 May 2012, Rogers, Michael K wrote:


I don't know if this helps but the following tells what the type of the image file is. (In my case I copied a jpg to img1 and a png to img2, without extensions of course.)

Thanks.


Hans implemented a version of unix file command for checking the type of images, but using the inbuilt library is definely simpler!


\startluacode
userdata = userdata or { }
function userdata.mytype(s)
context(img.scan({filename=s}).imagetype)
end
\stopluacode



@Hans, btw I also noticed that \locfilename does not work for files without extension. Create a file "one" in the current directory and then run:

\message{>>>\locfilename{one}<<<}
\end