Ahoi, I’m using a Lua function to calculate image sizes, cropping etc. This snippet: local filename = figures.current().status.fullname local pic = img.scan{filename = filename} ... works most of the time, but sometimes the "current" image is the previous one, might be because I’m using layers and postponing. So I’d like to use just the same filename as I give to \externalfigure, i.e. without path and extension. How can I address the same file path resolver in my Lua function? Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
On Fri, Feb 02, 2018 at 08:40:08AM +0100, Henning Hraban Ramm wrote:
Ahoi,
I’m using a Lua function to calculate image sizes, cropping etc. This snippet:
local filename = figures.current().status.fullname local pic = img.scan{filename = filename}
... works most of the time, but sometimes the "current" image is the previous one, might be because I’m using layers and postponing. So I’d like to use just the same filename as I give to \externalfigure, i.e. without path and extension. How can I address the same file path resolver in my Lua function?
Moin, Hraban, where could I find something about those lua functions? Regards, Rudolf
Am 2018-02-02 um 12:08 schrieb Rudolf Bahr
On Fri, Feb 02, 2018 at 08:40:08AM +0100, Henning Hraban Ramm wrote:
Ahoi,
I’m using a Lua function to calculate image sizes, cropping etc. This snippet:
local filename = figures.current().status.fullname local pic = img.scan{filename = filename}
... works most of the time, but sometimes the "current" image is the previous one, might be because I’m using layers and postponing. So I’d like to use just the same filename as I give to \externalfigure, i.e. without path and extension. How can I address the same file path resolver in my Lua function?
Moin, Hraban,
where could I find something about those lua functions?
Maybe here: http://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua The image placement functions I’m using are something Hans and others helped me accomplish during the last meeting; AFAIK there’s no real documentation. Find attached the lua part. It’s probably more complicated than necessary I could work around my original problem: I’m using my image with \externalfigure in an invisible place first, so it’s current, and figures.current().status is the right one. :) Here’s my (convoluted) placement macro: % image on empty page, caption in margin % usage: % \startpostponing[pagenumber] % \pagefig[reference]{caption}{filename} % \stoppostponing % postponing is important, otherwise the page numbering gets wrong \def\pagefig{\dosingleempty\doPagefig} \def\doPagefig[#1]#2#3{ % calculate image size \startfullpagemakeup \externalfigure[#3][width=1mm] % dummy to set image as current \def\myClipHeight{\ctxlua{ctxClipHeight("#3", \Resolution)}} \def\mystartY{\ctxlua{ctxStartY("#3", \Resolution)}} % image \setlayerframed[bglayer][% frame=off, offset=overlay, x=21mm, y=\mystartY, height=\myClipHeight, width=\textwidth, align=flushleft, ]{% \clip[ width=\textwidth, height=\myClipHeight, hoffset=0mm, voffset=0mm, % i.e. clip bottom! TODO: options! ]{\externalfigure[#3][width=\textwidth]} } \textreference[pre#1]{\myImgHeight} % caption \setlayerframed[bglayer][% frame=off, offset=overlay, linecorrection=on, x=143mm,y=\dimexpr\mystartY + 3pt\relax, height=\myClipHeight, width=\outermarginwidth, align={flushleft,low}, valign=bottom, ]{% \vbox{ \textreference[#1]{\strut #2}\vfill #2 }} \stopfullpagemakeup } usage example: \startpostponing[82] \pagefig[alinari-stelzen]{Gebrüder Alinari (Florenz, 19. Jhd.)}{ka34/img/Gebr-Alinari_Kinder_auf_Stelzen} \stoppostponing Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
On Fri, Feb 02, 2018 at 04:17:32PM +0100, Henning Hraban Ramm wrote:
Am 2018-02-02 um 12:08 schrieb Rudolf Bahr
: On Fri, Feb 02, 2018 at 08:40:08AM +0100, Henning Hraban Ramm wrote:
Ahoi,
I’m using a Lua function to calculate image sizes, cropping etc. This snippet:
local filename = figures.current().status.fullname local pic = img.scan{filename = filename}
... works most of the time, but sometimes the "current" image is the previous one, might be because I’m using layers and postponing. So I’d like to use just the same filename as I give to \externalfigure, i.e. without path and extension. How can I address the same file path resolver in my Lua function?
Moin, Hraban,
where could I find something about those lua functions?
Maybe here: http://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua
The image placement functions I’m using are something Hans and others helped me accomplish during the last meeting; AFAIK there’s no real documentation.
Find attached the lua part. It’s probably more complicated than necessary
I could work around my original problem: I’m using my image with \externalfigure in an invisible place first, so it’s current, and figures.current().status is the right one. :)
Here’s my (convoluted) placement macro:
% image on empty page, caption in margin % usage: % \startpostponing[pagenumber] % \pagefig[reference]{caption}{filename} % \stoppostponing % postponing is important, otherwise the page numbering gets wrong \def\pagefig{\dosingleempty\doPagefig} \def\doPagefig[#1]#2#3{ % calculate image size \startfullpagemakeup \externalfigure[#3][width=1mm] % dummy to set image as current \def\myClipHeight{\ctxlua{ctxClipHeight("#3", \Resolution)}} \def\mystartY{\ctxlua{ctxStartY("#3", \Resolution)}} % image \setlayerframed[bglayer][% frame=off, offset=overlay, x=21mm, y=\mystartY, height=\myClipHeight, width=\textwidth, align=flushleft, ]{% \clip[ width=\textwidth, height=\myClipHeight, hoffset=0mm, voffset=0mm, % i.e. clip bottom! TODO: options! ]{\externalfigure[#3][width=\textwidth]} } \textreference[pre#1]{\myImgHeight} % caption \setlayerframed[bglayer][% frame=off, offset=overlay, linecorrection=on, x=143mm,y=\dimexpr\mystartY + 3pt\relax, height=\myClipHeight, width=\outermarginwidth, align={flushleft,low}, valign=bottom, ]{% \vbox{ \textreference[#1]{\strut #2}\vfill #2 }} \stopfullpagemakeup }
usage example:
\startpostponing[82] \pagefig[alinari-stelzen]{Gebrüder Alinari (Florenz, 19. Jhd.)}{ka34/img/Gebr-Alinari_Kinder_auf_Stelzen} \stoppostponing
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Moin Hraban! It's very interesting for me to see, how exactly you calculate the size of images and texts with the help of lua! Up to now I used to use python and a independend lua to provide some necessary data for context. For instance python invokes graphicsmagick in order to get the size of images. Because it's provided in px and not in pt, so often some further manual work is unavoidable. Now, since lua and metafun are well integrated into context it suggests itself to use luatex instead of python, though I like this language very much. Thank you very much, Hraban, for putting your macros and links at my disposal! Regards, Rudolf
On 2/3/2018 7:57 AM, Rudolf Bahr wrote:
On Fri, Feb 02, 2018 at 04:17:32PM +0100, Henning Hraban Ramm wrote:
Am 2018-02-02 um 12:08 schrieb Rudolf Bahr
: On Fri, Feb 02, 2018 at 08:40:08AM +0100, Henning Hraban Ramm wrote:
Ahoi,
I’m using a Lua function to calculate image sizes, cropping etc. This snippet:
local filename = figures.current().status.fullname local pic = img.scan{filename = filename}
... works most of the time, but sometimes the "current" image is the previous one, might be because I’m using layers and postponing. So I’d like to use just the same filename as I give to \externalfigure, i.e. without path and extension. How can I address the same file path resolver in my Lua function?
Moin, Hraban,
where could I find something about those lua functions?
Maybe here: http://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua
The image placement functions I’m using are something Hans and others helped me accomplish during the last meeting; AFAIK there’s no real documentation.
Find attached the lua part. It’s probably more complicated than necessary
I could work around my original problem: I’m using my image with \externalfigure in an invisible place first, so it’s current, and figures.current().status is the right one. :)
Here’s my (convoluted) placement macro:
% image on empty page, caption in margin % usage: % \startpostponing[pagenumber] % \pagefig[reference]{caption}{filename} % \stoppostponing % postponing is important, otherwise the page numbering gets wrong \def\pagefig{\dosingleempty\doPagefig} \def\doPagefig[#1]#2#3{ % calculate image size \startfullpagemakeup \externalfigure[#3][width=1mm] % dummy to set image as current \def\myClipHeight{\ctxlua{ctxClipHeight("#3", \Resolution)}} \def\mystartY{\ctxlua{ctxStartY("#3", \Resolution)}} % image \setlayerframed[bglayer][% frame=off, offset=overlay, x=21mm, y=\mystartY, height=\myClipHeight, width=\textwidth, align=flushleft, ]{% \clip[ width=\textwidth, height=\myClipHeight, hoffset=0mm, voffset=0mm, % i.e. clip bottom! TODO: options! ]{\externalfigure[#3][width=\textwidth]} } \textreference[pre#1]{\myImgHeight} % caption \setlayerframed[bglayer][% frame=off, offset=overlay, linecorrection=on, x=143mm,y=\dimexpr\mystartY + 3pt\relax, height=\myClipHeight, width=\outermarginwidth, align={flushleft,low}, valign=bottom, ]{% \vbox{ \textreference[#1]{\strut #2}\vfill #2 }} \stopfullpagemakeup }
usage example:
\startpostponing[82] \pagefig[alinari-stelzen]{Gebrüder Alinari (Florenz, 19. Jhd.)}{ka34/img/Gebr-Alinari_Kinder_auf_Stelzen} \stoppostponing
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Moin Hraban!
It's very interesting for me to see, how exactly you calculate the size of images and texts with the help of lua!
Up to now I used to use python and a independend lua to provide some necessary data for context. For instance python invokes graphicsmagick in order to get the size of images. Because it's provided in px and not in pt, so often some further manual work is unavoidable.
Now, since lua and metafun are well integrated into context it suggests itself to use luatex instead of python, though I like this language very much.
Thank you very much, Hraban, for putting your macros and links at my disposal! Not sure what you want top know but a lot of image properties can be checked by prerolling:
\starttext \getfiguredimensions[t:/sources/cow.pdf] \starttabulate[|T|T|] \NC \string\figurewidth \NC \figurewidth \NC \NR \NC \string\figureheight \NC \figureheight \NC \NR \NC \string\figurexscale \NC \figurexscale \NC \NR \NC \string\figureyscale \NC \figureyscale \NC \NR \TB \NC \string\figuresize \NC \figuresize \NC \NR \NC \string\figurelabel \NC \figurelabel \NC \NR \NC \string\figurefileoriginal \NC \figurefileoriginal \NC \NR \NC \string\figurefilepage \NC \figurefilepage \NC \NR \NC \string\figurefileoptions \NC \figurefileoptions \NC \NR \NC \string\figurefileconversion\NC \figurefileconversion\NC \NR \NC \string\figurefileresolution\NC \figurefileresolution\NC \NR \NC \string\figurefilecolor \NC \figurefilecolor \NC \NR \NC \string\figurefilearguments \NC \figurefilearguments \NC \NR \NC \string\figurefilecache \NC \figurefilecache \NC \NR \NC \string\figurefileprefix \NC \figurefileprefix \NC \NR \TB \NC \string\figurenaturalwidth \NC \figurenaturalwidth \NC \NR \NC \string\figurenaturalheight \NC \figurenaturalheight \NC \NR \NC \string\figurexresolution \NC \figurexresolution \NC \NR \NC \string\figureyresolution \NC \figureyresolution \NC \NR \NC \string\figureorientation \NC \figureorientation \NC \NR \NC \string\figurerotation \NC \figurerotation \NC \NR \NC \string\figurexsize \NC \figurexsize \NC \NR \NC \string\figureysize \NC \figureysize \NC \NR \NC \string\figurecolordepth \NC \figurecolordepth \NC \NR \NC \string\figuredepth \NC \figuredepth \NC \NR \TB \NC \string\figurefullname \NC \figurefullname \NC \NR \NC \string\noffigurepages \NC \noffigurepages \NC \NR \TB \NC \string\figurefilepath \NC \figurefilepath \NC \NR \NC \string\figurefilename \NC \figurefilename \NC \NR \NC \string\figurefiletype \NC \figurefiletype \NC \NR \stoptabulate \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am 2018-02-04 um 13:06 schrieb Hans Hagen
Not sure what you want top know but a lot of image properties can be checked by prerolling: \getfiguredimensions[t:/sources/cow.pdf]
This is really interesting, but my original question was about the file path resolver, i.e. how to get "t:/sources/cow.pdf" from just "cow"? Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
On 02/04/2018 07:04 PM, Henning Hraban Ramm wrote:
Am 2018-02-04 um 13:06 schrieb Hans Hagen
: Not sure what you want top know but a lot of image properties can be checked by prerolling: \getfiguredimensions[t:/sources/cow.pdf]
This is really interesting, but my original question was about the file path resolver, i.e. how to get "t:/sources/cow.pdf" from just "cow"?
Hi Hraban, in case your question remains unanswered (which isn’t clear to me): \setupexternalfigures[location=default] \starttext \getfiguredimensions[cow.pdf] \starttabulate[|T|T|] \NC \string\figurefullname \NC \figurefullname \NC \NR \NC \string\figurefilepath \NC \figurefilepath \NC \NR \NC \string\figurefilename \NC \figurefilename \NC \NR \NC \string\figurefiletype \NC \figurefiletype \NC \NR \stoptabulate \stoptext Just in case it helps, Pablo -- http://www.ousia.tk
Hello Henning,
This is really interesting, but my original question was about the file path resolver, i.e. how to get "t:/sources/cow.pdf" from just "cow"?
I guess there was a similar question here: https://mailman.ntg.nl/pipermail/ntg-context/2017/088324.html Reading till the end, I deduce one has to collect snippets which appear in the code to build its own "file locator" as no function like "MyExternalFigureLocator()" exists in ConTeXt/Lua API. Some highlights: ----
Personally I use the lua variable named : figures.path
It’s a lua table which contains directories names you provide in directory= in \setupexternalfigures:
for _, path in ipairs(figures.paths) do local figure_file = path .. '/' .. file local doc = lpdf.epdf.load(figure_file) -- assume pdf (just an example) if doc then …. end done
Unfortunately, this code supposes the figure name was passed WITH extension, as no lookup in table-of-valid-extensions is performed (maybe no such table nor iterator exists).
There should be also:
----
local n = "x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf"
local d = figures.getinfo(n)
inspect(d)
----
And a snippet from another mailing thread:
---- (Hans' answer)
\getfiguredimensions[test.pdf]
\dorecurse {\noffigurepages} {
\getfiguredimensions[test.pdf][page=#1]
\figurenaturalwidth
,\figurenaturalheight,\figureorientation,\figurerotation\par
}
in lua you can either use the img library (see luatex manual) or context
helpers
local data = figures.push("foo.pdf")
figures.identify()
figures.check()
figures.pop()
inspect(data)
i'll add:
function figures.getinfo(name,page)
if type(name) == "string" then
name = { name = name, page = page }
end
if name.name then
local data = figures.push(name)
figures.identify()
figures.check()
figures.pop()
return data
end
end
so that one can do
local n = "ms.pdf"
local d = figures.getinfo(n)
if d then
for i=1,d.used.pages do
local p = figures.getinfo(n,i)
if p then
local u = p.used
print(u.width,u.height,u.orientation)
end
end
end
----
Hope this helps.
Best regards,
Lukas
On Sun, 04 Feb 2018 19:04:28 +0100, Henning Hraban Ramm
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396
Am 2018-02-06 um 09:34 schrieb Procházka Lukáš Ing.
Hello Henning,
This is really interesting, but my original question was about the file path resolver, i.e. how to get "t:/sources/cow.pdf" from just "cow"?
I guess there was a similar question here:
https://mailman.ntg.nl/pipermail/ntg-context/2017/088324.html
Reading till the end, I deduce one has to collect snippets which appear in the code to build its own "file locator" as no function like "MyExternalFigureLocator()" exists in ConTeXt/Lua API.
Dear Lukáš, thank you very much for collecting this information! I’ll try as soon as I get some time, since algorithmic image placement is a recurring problem for me, as I try to replace InDesign in my workflow. I thought about providing a module, but each of my projects has so differing needs that either every macro would need a bunch of options, or I need a lot of similar macros. We’ll see... Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Hello Henning,
On Tue, 06 Feb 2018 13:13:12 +0100, Henning Hraban Ramm
I’ll try as soon as I get some time, since algorithmic image placement is a recurring problem for me, as I try to replace InDesign in my workflow.
I thought about providing a module, but each of my projects has so differing needs that either every macro would need a bunch of options, or I need a lot of similar macros. We’ll see...
my experience in these situations: I'm usually implementing complicated solutions via Lua, with functions with obligatory arg(s) first followed by one optional argument of table type: - it's easy to investigate this optional argument and alter the algorithm depending on table keys (presence and/or value), - you don't have to be afraid of optional arg(s) rearrangement. To be more concrete: ---- Sample Lua code MyPlaceFigure = function(figname, opts) -- Optional; .scale = .sc, .rotation = .rot, .label, ... opts = opts or {} -- To simplify code bellow local scale, rot, lab = opts.scale or opts.sc, -- I.e. more keys are allowed in long/short alternative opts.rotation or opts.rotate or opts.rot, -- dtto opts.label or opts.lab, nil if label then -- E.g. use context.placefloat(...) else context.externalfigure({figname}, {scale = 1000 * scale, orientation = rot, }) end end ---- Best regards, Lukas
Greetlings, Hraban
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396
Am 2018-02-06 um 17:09 schrieb Procházka Lukáš Ing.
I'm usually implementing complicated solutions via Lua, with functions with obligatory arg(s) first followed by one optional argument of table type:
Thank you for your effort! I actually already wrote parts of my invoicing solution in Lua. I was planning to even run a simple GUI (tekui) on top of LuaTeX, but my priorities keep shifting... At the moment I got shell scripts that call Python scripts that read JSON files (as a simple database) and write ConTeXt code that includes (object oriented) Lua libraries for most of the the calculations... It works well enough for my own company and our publishing house, but is quite convoluted. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
On Sun, Feb 04, 2018 at 01:06:08PM +0100, Hans Hagen wrote:
On 2/3/2018 7:57 AM, Rudolf Bahr wrote:
On Fri, Feb 02, 2018 at 04:17:32PM +0100, Henning Hraban Ramm wrote:
Am 2018-02-02 um 12:08 schrieb Rudolf Bahr
: On Fri, Feb 02, 2018 at 08:40:08AM +0100, Henning Hraban Ramm wrote:
Ahoi,
I’m using a Lua function to calculate image sizes, cropping etc. This snippet:
local filename = figures.current().status.fullname local pic = img.scan{filename = filename}
... works most of the time, but sometimes the "current" image is the previous one, might be because I’m using layers and postponing. So I’d like to use just the same filename as I give to \externalfigure, i.e. without path and extension. How can I address the same file path resolver in my Lua function?
Moin, Hraban,
where could I find something about those lua functions?
Maybe here: http://source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua
The image placement functions I’m using are something Hans and others helped me accomplish during the last meeting; AFAIK there’s no real documentation.
Find attached the lua part. It’s probably more complicated than necessary
I could work around my original problem: I’m using my image with \externalfigure in an invisible place first, so it’s current, and figures.current().status is the right one. :)
Here’s my (convoluted) placement macro:
% image on empty page, caption in margin % usage: % \startpostponing[pagenumber] % \pagefig[reference]{caption}{filename} % \stoppostponing % postponing is important, otherwise the page numbering gets wrong \def\pagefig{\dosingleempty\doPagefig} \def\doPagefig[#1]#2#3{ % calculate image size \startfullpagemakeup \externalfigure[#3][width=1mm] % dummy to set image as current \def\myClipHeight{\ctxlua{ctxClipHeight("#3", \Resolution)}} \def\mystartY{\ctxlua{ctxStartY("#3", \Resolution)}} % image \setlayerframed[bglayer][% frame=off, offset=overlay, x=21mm, y=\mystartY, height=\myClipHeight, width=\textwidth, align=flushleft, ]{% \clip[ width=\textwidth, height=\myClipHeight, hoffset=0mm, voffset=0mm, % i.e. clip bottom! TODO: options! ]{\externalfigure[#3][width=\textwidth]} } \textreference[pre#1]{\myImgHeight} % caption \setlayerframed[bglayer][% frame=off, offset=overlay, linecorrection=on, x=143mm,y=\dimexpr\mystartY + 3pt\relax, height=\myClipHeight, width=\outermarginwidth, align={flushleft,low}, valign=bottom, ]{% \vbox{ \textreference[#1]{\strut #2}\vfill #2 }} \stopfullpagemakeup }
usage example:
\startpostponing[82] \pagefig[alinari-stelzen]{Gebrüder Alinari (Florenz, 19. Jhd.)}{ka34/img/Gebr-Alinari_Kinder_auf_Stelzen} \stoppostponing
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Moin Hraban!
It's very interesting for me to see, how exactly you calculate the size of images and texts with the help of lua!
Up to now I used to use python and a independend lua to provide some necessary data for context. For instance python invokes graphicsmagick in order to get the size of images. Because it's provided in px and not in pt, so often some further manual work is unavoidable.
Now, since lua and metafun are well integrated into context it suggests itself to use luatex instead of python, though I like this language very much.
Thank you very much, Hraban, for putting your macros and links at my disposal! Not sure what you want top know but a lot of image properties can be checked by prerolling:
\starttext
\getfiguredimensions[t:/sources/cow.pdf]
\starttabulate[|T|T|] \NC \string\figurewidth \NC \figurewidth \NC \NR \NC \string\figureheight \NC \figureheight \NC \NR \NC \string\figurexscale \NC \figurexscale \NC \NR \NC \string\figureyscale \NC \figureyscale \NC \NR \TB \NC \string\figuresize \NC \figuresize \NC \NR \NC \string\figurelabel \NC \figurelabel \NC \NR \NC \string\figurefileoriginal \NC \figurefileoriginal \NC \NR \NC \string\figurefilepage \NC \figurefilepage \NC \NR \NC \string\figurefileoptions \NC \figurefileoptions \NC \NR \NC \string\figurefileconversion\NC \figurefileconversion\NC \NR \NC \string\figurefileresolution\NC \figurefileresolution\NC \NR \NC \string\figurefilecolor \NC \figurefilecolor \NC \NR \NC \string\figurefilearguments \NC \figurefilearguments \NC \NR \NC \string\figurefilecache \NC \figurefilecache \NC \NR \NC \string\figurefileprefix \NC \figurefileprefix \NC \NR \TB \NC \string\figurenaturalwidth \NC \figurenaturalwidth \NC \NR \NC \string\figurenaturalheight \NC \figurenaturalheight \NC \NR \NC \string\figurexresolution \NC \figurexresolution \NC \NR \NC \string\figureyresolution \NC \figureyresolution \NC \NR \NC \string\figureorientation \NC \figureorientation \NC \NR \NC \string\figurerotation \NC \figurerotation \NC \NR \NC \string\figurexsize \NC \figurexsize \NC \NR \NC \string\figureysize \NC \figureysize \NC \NR \NC \string\figurecolordepth \NC \figurecolordepth \NC \NR \NC \string\figuredepth \NC \figuredepth \NC \NR \TB \NC \string\figurefullname \NC \figurefullname \NC \NR \NC \string\noffigurepages \NC \noffigurepages \NC \NR \TB \NC \string\figurefilepath \NC \figurefilepath \NC \NR \NC \string\figurefilename \NC \figurefilename \NC \NR \NC \string\figurefiletype \NC \figurefiletype \NC \NR \stoptabulate
\stoptext
This is very good and useful, thank you, Hans! I need this to set a bunch of family history books with plenty of photos, texts, family trees, journey diaries, scans, index of persons etc. With the help of context+luatex+metafun I'd like to set the pages hopefully without the need of too much manual corrections, i.e in a as far as possible automated way. There is a lot of material, especially nowadays the flood of digital pictures. At the moment I succeed in setting only 2 or 3 such year-books per year. Thanks again for your help, Rudolf
Am 2018-02-04 um 13:06 schrieb Hans Hagen
Not sure what you want top know but a lot of image properties can be checked by prerolling:
\getfiguredimensions[t:/sources/cow.pdf] ... \NC \string\figurefilepath \NC \figurefilepath \NC \NR \NC \string\figurefilename \NC \figurefilename \NC \NR \NC \string\figurefiletype \NC \figurefiletype \NC \NR
Sorry, I didn’t recognize that this also answered my question! Seems like I can condense my calculations a lot... I started some documentation here: http://wiki.contextgarden.net/Image_Placement A few of the variables don’t work: \figurefileresolution, \figurefilecolor, \figurefilearguments, \figureorientation and \figurerotation all lead to errors. I checked only in the garden yet, so maybe these are quite new? Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Am 2018-02-04 um 13:06 schrieb Hans Hagen
\getfiguredimensions[t:/sources/cow.pdf]
\starttabulate[|T|T|] \NC \string\figurewidth \NC \figurewidth \NC \NR \NC \string\figureheight \NC \figureheight \NC \NR \NC \string\figurexscale \NC \figurexscale \NC \NR \NC \string\figureyscale \NC \figureyscale \NC \NR ... \TB \NC \string\figurefullname \NC \figurefullname \NC \NR \NC \string\noffigurepages \NC \noffigurepages \NC \NR \TB \NC \string\figurefilepath \NC \figurefilepath \NC \NR \NC \string\figurefilename \NC \figurefilename \NC \NR \NC \string\figurefiletype \NC \figurefiletype \NC \NR \stoptabulate
Next try: How can I access these values from Lua? While \ctxlua{print("\figureheight")} works, context.figureheight is a function value (?), context.figureheight() or tex.figureheight() is nil, tex.getdimen("figureheight") is also wrong, and it’s also no glue. I’d be thankful for a hint. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
participants (5)
-
Hans Hagen
-
Henning Hraban Ramm
-
Pablo Rodriguez
-
Procházka Lukáš Ing.
-
Rudolf Bahr