On 7/11/2023 2:22 PM, Henning Hraban Ramm wrote:
What’s the current approved way to get image properties within a Lua
function?
very old:
local pic = figures.getinfo(figures.current().status.fullname)
used to work in 2019:
local pic = img.scan{filename = figures.current().status.fullname}
if I understand this right, "img" isn’t valid anymore:
"""
token call, execute: grph-imagelib.lua:37: attempt to index a nil value
(global 'img')
"""
I’d like to know the pixel size and if possible also the scaled target
size of an image; either the "current" one or by name.
\ctxlua{inspect(figures.getinfo("t:/sources/mill.png").used)}
\ctxlua{inspect(figures.getinfo("t:/sources/mill.png").status)}
etc .. no more faking the img lib
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________