Hello Pablo,

also Lua might be useful for you - some code like the one bellow, which is based on an answer in this forum years ago:

----
assert(not figures.getinfo2)

figures.getinfo2 = function(name, page) -- [ [NTG-context] Pdf info with Lua/Ctx API ]
  if type(name) == "string" then
    name = { name = name, page = page }
  end

  if name.name then
    local data = figures.push(name)
    local info = figures.identify()

    if info.status.status ~= 0 then
      figures.check() -- !Counts pages here!
    end

    figures.pop()

    return --data
           info
  end
end
----

'info' might return not only width and height of the image, but also its orientation/rotation. And it would be up to you whether to swap width/height depending on orientation.

Hope this helps.

Best regards,

Lukas


On 2020-01-29 16:44, Pablo Rodriguez wrote:
On 1/29/20 2:31 PM, Arthur Reutenauer wrote:
On Tue, Jan 28, 2020 at 05:43:36PM +0100, Pablo Rodriguez wrote:
I’m afraid this is the second time I’m aware of the existence of \ifdim
(the first time was when reading previous message from Taco πŸ˜…).

  It’s a TeX primitive.  From the TeXbook, chapter 20:

        * \ifdim<dimen1><relation><dimen2>  (compares two dimensions)
        This is like \ifnum, but it compares two <dimen> values.  For
        example, to test whether the value of \hsize exceeds 100pt, you
        can say β€˜\ifdim\hsize>100pt’.

  The definition of \ifnum, right above it, states:

        * \ifnum<number1><relation><number2>  (compares two integers)
        The <relation> must be either β€˜<’ or β€˜=’ or β€˜>’.  The two
        integer numbers are compared to each other in the usual way, and
        the result is true or false accordingly.

Many thanks for your reply, Arthur.

The explanation is extremely clear. I think I should try to read the
TeXbook (but I need time for this first).

Many thanks for your help,

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

Reply via email to