ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Peter Münster" <pmlists@free.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: width/height in figure converter (was: t-degrade.tex)
Date: Tue, 31 Jul 2012 17:04:11 +0200	[thread overview]
Message-ID: <87haso6kgk.fsf@micropit.couberia.bzh> (raw)
In-Reply-To: <877gtpv5lk.fsf@micropit.couberia.bzh> ("Peter =?utf-8?Q?M?= =?utf-8?Q?=C3=BCnster=22's?= message of "Fri, 27 Jul 2012 12:52:23 +0200")

On Fri, Jul 27 2012, Peter Münster wrote:

> Does it make sense, to port http://modules.contextgarden.net/t-degrade
> to mkiv, or is there already an existing solution in ConTeXt to
> downsample jpeg-images on the fly?

I've played a bit with the converters:

--8<---------------cut here---------------start------------->8---
\startluacode
figures.converters["jpg"] = {
  ["lowres.jpg"] = function(oldname,newname,resolution)
    os.execute"something"
    print(table.serialize(figures.current()))
  end
}
\stopluacode
\starttext
\externalfigure[hacker][width=0.5\textwidth, conversion=lowres.jpg]
\stoptext 
--8<---------------cut here---------------end--------------->8---

2 questions:

- How can I get the width and/or the height of the figure inside the
  function?  "0.5\9extwidth " is not very useful on the lua-side...

- How can I specify a sub-directory where to place the converted images?
  (not so important, just to avoid cluttering the current directory)


TIA for any help,
-- 
           Peter
___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2012-07-31 15:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 10:52 t-degrade.tex Peter Münster
2012-07-31  7:22 ` t-degrade.tex Jan Kula
2012-07-31  8:32   ` t-degrade.tex luigi scarso
2012-07-31 15:04 ` Peter Münster [this message]
2012-07-31 22:36 ` t-degrade.tex (solved) Peter Münster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87haso6kgk.fsf@micropit.couberia.bzh \
    --to=pmlists@free.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).