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

Aditya

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to