ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Henning Hraban Ramm <texml@fiee.net>
Subject: Re: parameters of (setup)externalfigure, conversions etc.
Date: Fri, 12 Aug 2022 13:07:17 +0200	[thread overview]
Message-ID: <30692272-f75d-afc3-4825-8dfa504f5d87@fiee.net> (raw)
In-Reply-To: <47b7688c-dcf0-3dc7-dfe1-e4b887f190ca@fiee.net>

Am 11.08.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context:
> Hi Hans,
> 
> yesterday you told me about the image conversions in grph-con.lua, and I 
> tried to find out how to use them. Up to know I only knew "mp" for SVG 
> images.
> 
> I found I can use "gray.pdf" or "cmyk.pdf" to convert an image (JPG or 
> PNG) to grayscale/CMYK, but the resolution isn’t used for downsampling 
> (of course, it’s not mentioned in the command template):
> 
> \externalfigure[hacker][conversion={gray.pdf},resolution=72]
> 
> I tried to write my own downsampling converter, but don’t understand how 
> I can hook it into the list of converters:
> 
> """
> 
> local downsample = sandbox.registerrunner {
>    name     = "downsample",
>    program  = "gm",
> template = [[convert -compress Zip -sampling-factor 1x1 -density 
> %resolution%x%resolution% -resample %resolution%x%resolution% %oldname% 
> %newname%]],
>    checkers = checkers,
>    defaults = defaults,
> }
> 
> programs.downsample = { runner = downsample }

I found the solution in 
https://wiki.contextgarden.net/Using_Graphics#Image_Conversion, but 
that’s not as elegant as those in grph-inc.lua

(And I learned that ImageMagick’s convert works differently than 
GraphicsMagick’s WRT -density; i.e. you must use "gm convert".)

Peter Münster’s grph-downsample.lua was better, it calculated the actual 
pixel size necessary, but that doesn’t work any more.

> """
> 
> (I’m not sure if I must calculate the desired pixel size beforehand.)
> 
> -*-*-
> 
> Apart from converters, there are several parameters of \externalfigure 
> that I don’t understand and thus can’t document in the Wiki; a few are 
> even not yet documented in the interface files:
> 
> * equalwidth/equalheight
> * s/sx/sy
> * xmax/ymax
> * prefix, label, comment
> * bodyfont
> * mask
> * frames (≠ frame)
> * interaction (PDF inclusion; found)crossreference
> * resources
> * display (alternative source? multimedia only?)
> * order (of extensions; found)
> * crop, transform
> * controls, preview: only related to video and thus obsolete?
> * hfactor/wfactor: When do these make sense? (I know factor)

Also, orientation seems to be missing in the interface (auto-syntax 
doesn’t pick it up).

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

      reply	other threads:[~2022-08-12 11:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 13:51 Henning Hraban Ramm via ntg-context
2022-08-12 11:07 ` Henning Hraban Ramm via ntg-context [this message]

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=30692272-f75d-afc3-4825-8dfa504f5d87@fiee.net \
    --to=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /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).