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’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, crossreference
* resources
* display
* order
* crop, transform
* controls, preview: only related to video and thus obsolete?
* hfactor/wfactor: When do these make sense? (I know factor)

I accidentally learned that I can use parameters of \framed, but the inheritance from \setupframed is not explicit – some are mentioned, like backgroundcolor, others not, even if they work, like corner (but they don’t affect the image).


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 via email to