Am 22.08.23 um 04:19 schrieb Benjamin Buchmuller:
I had the same question a couple of days ago and I found a thread on the
mailing list, which I'm reposting here. Although this worked for me, I found
downsampling of the pdf with gs more convenient.
Here’s a shorter solution:
\startluacode
local function downsampler(oldname, newname, resolution)
if not resolution or resolution == "" then
resolution = 72
end
local cmd = string.format(
[[gm convert -resample %ix%i %s %s]],
resolution, resolution, oldname, newname)
-- print(cmd)
os.execute(cmd)
end
-- Set the PDF and default JPEG converters to the above function.
figures.converters.jpg.pdf = downsampler
figures.converters.jpg.default = downsampler
\stopluacode
You can set the resolution in \setupexternalfigure this way.
But the calculation doesn’t take scaling into account, I have this on my
todo list for too long…
And it should be possible to hook this into "conversion"…
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
___________________________________________________________________________________