ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* degrade module
@ 2019-02-14 19:49 Lutz Haseloff
  2019-02-14 20:22 ` Marco Patzer
  2019-02-14 20:32 ` Peter Münster
  0 siblings, 2 replies; 23+ messages in thread
From: Lutz Haseloff @ 2019-02-14 19:49 UTC (permalink / raw)
  To: Context Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 243 bytes --]

Hi Peter, hi all,

I wanted to use the degrade module with recent ConTeXt and LuaTeX.
The minimal example from the degrade manual gives an error.
See the attached log.
Is there any chance to get the module working again?

Greetings Lutz

[-- Attachment #1.2: Type: text/html, Size: 257 bytes --]

[-- Attachment #2: verkleinert.log --]
[-- Type: application/octet-stream, Size: 7440 bytes --]

open source     > level 1, order 1, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system          > 
system          > ConTeXt  ver: 2019.02.10 17:43 MKIV beta  fmt: 2019.2.11  int: english/english
system          > 
system          > 'cont-new.mkiv' loaded
open source     > level 2, order 2, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system          > beware: some patches loaded from cont-new.mkiv
close source    > level 2, order 2, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system          > files > jobname 'verkleinert', input './verkleinert', result 'verkleinert'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
open source     > level 2, order 3, name '/sdcard/work/degrade/verkleinert.tex'
modules         > 'degrade' is loaded
open source     > level 3, order 4, name '/usr/local/context/tex/texmf-modules/tex/context/third/degrade/t-degrade.tex'
loading         > Degrading JPEG images on the fly
close source    > level 3, order 4, name '/usr/local/context/tex/texmf-modules/tex/context/third/degrade/t-degrade.tex'
fonts           > preloading latin modern fonts (second stage)
fonts           > 'fallback modern-designsize rm 12pt' is loaded

tex error       > tex error on line 4 in file /sdcard/work/degrade/verkleinert.tex: ! Undefined control sequence

<write> ... -degrade-script.tmp hacker \ifcase \pdfoutput 
                                                  eps\else pdf\fi \space \De...
<inserted text> 
}\endwrite 
\externalfigure ...space \DegSDir \space \DegDir }
                                                  \doiffileexistselse {\DegD...
l.4 \externalfigure[hacker][width=0.2\textwidth]
                                              

1     \usemodule[degrade]
2     \setupDegrade[Res=100,Dir=degraded,SDir=.]
3     \starttext
4 >>  \externalfigure[hacker][width=0.2\textwidth]
5     \stoptext


? x

system          > start used files

system          > text: verkleinert

system          > stop used files


system          > start used files

system          >    1: filename=char-prv.lua filetype=tex format=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua usedmethod=database
system          >    2: filename=cont-yes.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv usedmethod=database
system          >    3: filename=publ-imp-default.lua filetype=lua foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua usedmethod=database
system          >    4: filename=cont-new.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv usedmethod=database
system          >    5: filename=lang-exc.lua filetype=lua foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua usedmethod=database
system          >    6: filename=lang-us.lua filetype=lua foundname=/usr/local/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua fullname=/usr/local/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua usedmethod=database
system          >    7: filename=/sdcard/work/degrade/verkleinert.tex foundname=/sdcard/work/degrade/verkleinert.tex fullname=/sdcard/work/degrade/verkleinert.tex usedmethod=direct
system          >    8: filename=t-degrade.tex filetype=tex foundname=/usr/local/context/tex/texmf-modules/tex/context/third/degrade/t-degrade.tex fullname=/usr/local/context/tex/texmf-modules/tex/context/third/degrade/t-degrade.tex usedmethod=database
system          >    9: filename=lm.lfg filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg fullname=/usr/local/context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg usedmethod=database
system          >   10: filename=lmroman12-regular filetype=otf format=otf foundname=/usr/local/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf fullname=/usr/local/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf usedmethod=database
system          >   11: filename=latinmodern-math.otf filetype=opentypefonts foundname=/usr/local/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf fullname=/usr/local/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf usedmethod=database

system          > stop used files


system          > start commandline options

system          > currentrun="1"
system          > fulljobname="./verkleinert.tex"
system          > input="./verkleinert.tex"
system          > kindofrun="1"
system          > maxnofruns="9"
system          > texmfbinpath="/usr/local/context/tex/texmf-linux-armhf/bin"

system          > stop commandline options


system          > start commandline files

system          >    1: ./verkleinert.tex

system          > stop commandline files


modules         > start used modules

modules         > loaded : *-degrade

modules         > stop used modules


mkiv lua stats  > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path: /usr/local/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e
mkiv lua stats  > resource resolver: loadtime 0.114 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 11 found files, scanned paths: <none>
mkiv lua stats  > stored bytecode data: 441 modules (0.937 sec), 93 tables (0.069 sec), 534 chunks (1.006 sec)
mkiv lua stats  > traced context: maxstack: 1369, freed: 0, unreachable: 1369
mkiv lua stats  > cleaned up reserved nodes: 50 nodes, 9 lists of 440
mkiv lua stats  > node memory usage: 1 dir, 2 kern, 5 attribute, 50 glue_spec, 2 attribute_list, 2 temp, 1 if_stack, 1 write, 2 user_defined
mkiv lua stats  > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats  > jobdata time: 0.000 seconds saving, 0.000 seconds loading
mkiv lua stats  > callbacks: internal: 48, file: 302, direct: 2, late: 0, function 485, total: 837
mkiv lua stats  > loaded tex modules: 1 requested, all found (*-degrade)
mkiv lua stats  > result saved in file: verkleinert.pdf, compresslevel 3, objectcompresslevel 3
mkiv lua stats  > loaded patterns: en::1, load time: 0.000
mkiv lua stats  > loaded fonts: 2 files: latinmodern-math.otf, lmroman12-regular.otf
mkiv lua stats  > font engine: otf 3.107, afm 1.513, tfm 1.000, 7 instances, 5 shared in backend, 1 common vectors, 4 common hashes, load time 0.835 seconds 
mkiv lua stats  > used platform: linux, type: unix, binary subtree: texmf-linux-armhf
mkiv lua stats  > used engine: luatex version 1.093 with functionality level 7079, banner: this is luatex, version 1.09.3 (tex live 2019/dev)
mkiv lua stats  > control sequences: 45224 of 65536 + 100000
mkiv lua stats  > lua properties: engine: lua 5.3, used memory: 70 MB (ctx: 69 MB), hash type: lua, hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 5.091 seconds


[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 19:49 degrade module Lutz Haseloff
@ 2019-02-14 20:22 ` Marco Patzer
  2019-02-14 20:37   ` Peter Münster
  2019-02-14 20:32 ` Peter Münster
  1 sibling, 1 reply; 23+ messages in thread
From: Marco Patzer @ 2019-02-14 20:22 UTC (permalink / raw)
  To: ntg-context

On Thu, 14 Feb 2019 20:49:43 +0100
Lutz Haseloff <lutz.haseloff@toppkieker.info> wrote:

> I wanted to use the degrade module with recent ConTeXt and LuaTeX.
> The minimal example from the degrade manual gives an error.
> See the attached log.
> Is there any chance to get the module working again?

I never used the degrade module. Instead I use the downsample.lua
script which works fine with a current beta. Maybe give it a try.

Apparently it's not on the wiki and if I remember correctly I got it
off the mailing list. Let me know if you can't find it.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 19:49 degrade module Lutz Haseloff
  2019-02-14 20:22 ` Marco Patzer
@ 2019-02-14 20:32 ` Peter Münster
  2019-02-14 20:41   ` Wolfgang Schuster
  2019-02-14 20:44   ` Hans Hagen
  1 sibling, 2 replies; 23+ messages in thread
From: Peter Münster @ 2019-02-14 20:32 UTC (permalink / raw)
  To: ntg-context

On Thu, Feb 14 2019, Lutz Haseloff wrote:

> I wanted to use the degrade module with recent ConTeXt and LuaTeX.

Hi Lutz,

Could you please check, if the module grph-downsample.lua could fit your
needs?


> The minimal example from the degrade manual gives an error.
> See the attached log.
> Is there any chance to get the module working again?

There is always a chance. The question is just: who will afford the
efforts...
Please check first the downsample module, and then let's see, if you
still need this very old and hackish degrade module.

Cheers,
-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 20:22 ` Marco Patzer
@ 2019-02-14 20:37   ` Peter Münster
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Münster @ 2019-02-14 20:37 UTC (permalink / raw)
  To: ntg-context

On Thu, Feb 14 2019, Marco Patzer wrote:

> Apparently it's not on the wiki

It's here:
https://modules.contextgarden.net/dl/grph-downsample.lua-1.001.zip

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 20:32 ` Peter Münster
@ 2019-02-14 20:41   ` Wolfgang Schuster
  2019-02-14 21:00     ` Peter Münster
  2019-02-14 20:44   ` Hans Hagen
  1 sibling, 1 reply; 23+ messages in thread
From: Wolfgang Schuster @ 2019-02-14 20:41 UTC (permalink / raw)
  To: ntg-context

Peter Münster schrieb am 14.02.19 um 21:32:
> On Thu, Feb 14 2019, Lutz Haseloff wrote:
>
>> I wanted to use the degrade module with recent ConTeXt and LuaTeX.
> Hi Lutz,
>
> Could you please check, if the module grph-downsample.lua could fit your
> needs?

Take a look at section 3.2 of the workflows [1] document.

[1] http://www.pragma-ade.nl/general/manuals/workflows-mkiv.pdf

Wolfgang

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 20:32 ` Peter Münster
  2019-02-14 20:41   ` Wolfgang Schuster
@ 2019-02-14 20:44   ` Hans Hagen
  2019-02-15  6:56     ` Lutz Haseloff
  1 sibling, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2019-02-14 20:44 UTC (permalink / raw)
  To: ntg-context

On 2/14/2019 9:32 PM, Peter Münster wrote:
> On Thu, Feb 14 2019, Lutz Haseloff wrote:
> 
>> I wanted to use the degrade module with recent ConTeXt and LuaTeX.
> 
> Hi Lutz,
> 
> Could you please check, if the module grph-downsample.lua could fit your
> needs?
> 
> 
>> The minimal example from the degrade manual gives an error.
>> See the attached log.
>> Is there any chance to get the module working again?
> 
> There is always a chance. The question is just: who will afford the
> efforts...
> Please check first the downsample module, and then let's see, if you
> still need this very old and hackish degrade module.
you can plug in code

\startluacode

figures.converters["png"]["lowres.png"] = 
function(oldname,newname,resolution)
     os.execute(string.format('gm convert "%s" "%s"',oldname,newname))
end

figures.converters["jpg"]["lowres.jpg"] = 
function(oldname,newname,resolution)
     os.execute(string.format('gm convert "%s" "%s"',oldname,newname))
end

-- figures.suffixes["lowres.png"] = figures.suffixes.png -- suffix is 
automatically done

\stopluacode
\enabletrackers[graphics*]


\starttext
     \externalfigure[t:/sources/mill.png][conversion=lowres.png]
     \externalfigure[t:/sources/hacker.jpg][conversion=lowres.jpg]
\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 20:41   ` Wolfgang Schuster
@ 2019-02-14 21:00     ` Peter Münster
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Münster @ 2019-02-14 21:00 UTC (permalink / raw)
  To: ntg-context

On Thu, Feb 14 2019, Wolfgang Schuster wrote:

> Take a look at section 3.2 of the workflows [1] document.
>
> [1] http://www.pragma-ade.nl/general/manuals/workflows-mkiv.pdf

Sorry, I don't understand. How will the "convert" command
"convert -geometry %nx%x%ny% -compress JPEG ..." ever know, that the
target height is 10cm?

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-14 20:44   ` Hans Hagen
@ 2019-02-15  6:56     ` Lutz Haseloff
  2019-02-15  7:24       ` Henning Hraban Ramm
  2019-02-15  7:25       ` Marco Patzer
  0 siblings, 2 replies; 23+ messages in thread
From: Lutz Haseloff @ 2019-02-15  6:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2541 bytes --]

Thank you all for your help.

First i tried the grph-downsample.lua script.
Unfortunately i get an error message
grph-downsample.lua:31: bad argument #2 to 'format' (number has no integer representation)
See attached log file.

Greetings Lutz

Am 14. Februar 2019 21:44:31 MEZ schrieb Hans Hagen <j.hagen@xs4all.nl>:
>On 2/14/2019 9:32 PM, Peter Münster wrote:
>> On Thu, Feb 14 2019, Lutz Haseloff wrote:
>> 
>>> I wanted to use the degrade module with recent ConTeXt and LuaTeX.
>> 
>> Hi Lutz,
>> 
>> Could you please check, if the module grph-downsample.lua could fit
>your
>> needs?
>> 
>> 
>>> The minimal example from the degrade manual gives an error.
>>> See the attached log.
>>> Is there any chance to get the module working again?
>> 
>> There is always a chance. The question is just: who will afford the
>> efforts...
>> Please check first the downsample module, and then let's see, if you
>> still need this very old and hackish degrade module.
>you can plug in code
>
>\startluacode
>
>figures.converters["png"]["lowres.png"] = 
>function(oldname,newname,resolution)
>     os.execute(string.format('gm convert "%s" "%s"',oldname,newname))
>end
>
>figures.converters["jpg"]["lowres.jpg"] = 
>function(oldname,newname,resolution)
>     os.execute(string.format('gm convert "%s" "%s"',oldname,newname))
>end
>
>-- figures.suffixes["lowres.png"] = figures.suffixes.png -- suffix is 
>automatically done
>
>\stopluacode
>\enabletrackers[graphics*]
>
>
>\starttext
>     \externalfigure[t:/sources/mill.png][conversion=lowres.png]
>     \externalfigure[t:/sources/hacker.jpg][conversion=lowres.jpg]
>\stoptext
>
>
>
>-----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>-----------------------------------------------------------------
>___________________________________________________________________________________
>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
>___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 3121 bytes --]

[-- Attachment #2: verkleinert-downsample.log --]
[-- Type: application/octet-stream, Size: 6727 bytes --]

open source     > level 1, order 1, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system          > 
system          > ConTeXt  ver: 2019.02.10 17:43 MKIV beta  fmt: 2019.2.11  int: english/english
system          > 
system          > 'cont-new.mkiv' loaded
open source     > level 2, order 2, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system          > beware: some patches loaded from cont-new.mkiv
close source    > level 2, order 2, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system          > files > jobname 'verkleinert-downsample', input './verkleinert-downsample', result 'verkleinert-downsample'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
open source     > level 2, order 3, name '/sdcard/work/degrade/verkleinert-downsample.tex'
fonts           > preloading latin modern fonts (second stage)
fonts           > 'fallback modern-designsize rm 12pt' is loaded

lua error       > lua error on line 5 in file /sdcard/work/degrade/verkleinert-downsample.tex:

grph-downsample.lua:31: bad argument #2 to 'format' (number has no integer representation)

1     \loadluafile[grph-downsample]
2     \setupexternalfigures[conversion=lowres.jpg, resolution=10]
3     \starttext
4     \externalfigure[hacker.jpg][width=5cm]
5 >>  \stoptext


? x

system          > start used files

system          > text: verkleinert-downsample

system          > stop used files


system          > start used files

system          >    1: filename=char-prv.lua filetype=tex format=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua usedmethod=database
system          >    2: filename=cont-yes.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv usedmethod=database
system          >    3: filename=publ-imp-default.lua filetype=scripts foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua usedmethod=database
system          >    4: filename=cont-new.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv usedmethod=database
system          >    5: filename=lang-exc.lua filetype=scripts foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua usedmethod=database
system          >    6: filename=lang-us.lua filetype=scripts foundname=/usr/local/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua fullname=/usr/local/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua usedmethod=database
system          >    7: filename=/sdcard/work/degrade/verkleinert-downsample.tex foundname=/sdcard/work/degrade/verkleinert-downsample.tex fullname=/sdcard/work/degrade/verkleinert-downsample.tex usedmethod=direct
system          >    8: filename=lm.lfg filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg fullname=/usr/local/context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg usedmethod=database
system          >    9: filename=lmroman12-regular filetype=otf format=otf foundname=/usr/local/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf fullname=/usr/local/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf usedmethod=database
system          >   10: filename=latinmodern-math.otf filetype=opentypefonts foundname=/usr/local/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf fullname=/usr/local/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf usedmethod=database
system          >   11: filename=hacker.jpg format=tex foundname=hacker.jpg fullname=/sdcard/work/degrade/hacker.jpg usedmethod=direct

system          > stop used files


system          > start commandline options

system          > currentrun="1"
system          > fulljobname="./verkleinert-downsample.tex"
system          > input="./verkleinert-downsample.tex"
system          > kindofrun="1"
system          > maxnofruns="9"
system          > texmfbinpath="/usr/local/context/tex/texmf-linux-armhf/bin"

system          > stop commandline options


system          > start commandline files

system          >    1: ./verkleinert-downsample.tex

system          > stop commandline files


modules         > start used modules


modules         > stop used modules


mkiv lua stats  > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path: /usr/local/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e
mkiv lua stats  > resource resolver: loadtime 0.104 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 11 found files, scanned paths: <none>
mkiv lua stats  > stored bytecode data: 441 modules (0.922 sec), 93 tables (0.071 sec), 534 chunks (0.993 sec)
mkiv lua stats  > traced context: maxstack: 1369, freed: 0, unreachable: 1369
mkiv lua stats  > cleaned up reserved nodes: 50 nodes, 9 lists of 440
mkiv lua stats  > node memory usage: 1 hlist, 1 dir, 2 kern, 4 attribute, 61 glue_spec, 2 attribute_list, 2 temp, 1 if_stack, 2 user_defined
mkiv lua stats  > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats  > jobdata time: 0.010 seconds saving, 0.001 seconds loading
mkiv lua stats  > callbacks: internal: 32, file: 146, direct: 2, late: 0, function 484, total: 664
mkiv lua stats  > result saved in file: verkleinert-downsample.pdf, compresslevel 3, objectcompresslevel 3
mkiv lua stats  > loaded patterns: en::1, load time: 0.000
mkiv lua stats  > loaded fonts: 2 files: latinmodern-math.otf, lmroman12-regular.otf
mkiv lua stats  > font engine: otf 3.107, afm 1.513, tfm 1.000, 7 instances, 5 shared in backend, 1 common vectors, 4 common hashes, load time 0.831 seconds 
mkiv lua stats  > used platform: linux, type: unix, binary subtree: texmf-linux-armhf
mkiv lua stats  > used engine: luatex version 1.093 with functionality level 7079, banner: this is luatex, version 1.09.3 (tex live 2019/dev)
mkiv lua stats  > control sequences: 45211 of 65536 + 100000
mkiv lua stats  > lua properties: engine: lua 5.3, used memory: 52 MB (ctx: 51 MB), hash type: lua, hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 14.576 seconds


[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15  6:56     ` Lutz Haseloff
@ 2019-02-15  7:24       ` Henning Hraban Ramm
  2019-02-15  7:25       ` Marco Patzer
  1 sibling, 0 replies; 23+ messages in thread
From: Henning Hraban Ramm @ 2019-02-15  7:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Am 2019-02-15 um 07:56 schrieb Lutz Haseloff <lutz.haseloff@toppkieker.info>:

> Thank you all for your help.
> 
> First i tried the grph-downsample.lua script.
> Unfortunately i get an error message
> grph-downsample.lua:31: bad argument #2 to 'format' (number has no integer representation)
> See attached log file.

It’s a problem due to changes in Lua between 5.2 and 5.3 (or the like).
The attached version works (for me).


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD



[-- Attachment #2: grph-downsample.lua --]
[-- Type: application/octet-stream, Size: 1601 bytes --]

if not modules then modules = { } end modules ['grph-downsample'] = {
  version   = 1.001,
  comment   = "companion to grph-inc.mkiv",
  author    = "Peter Münster",
  copyright = "PRAGMA ADE / ConTeXt Development Team",
  license   = "see context related readme files"
}

local format = string.format
-- figures.cachepaths.path = "cache" -- should be setup-option
local function sample_down(oldname, newname, resolution)
  local request = figures.current().request
  local width = request.width
  local height = request.height
  if resolution == "" or (not width and not height) then
    print(format("Nothing to do: %s, %s, %s", oldname, newname, resolution))
    return
  end
  local TEXpt = 65536
  local inch = 72.27
  local image = img.scan{filename = oldname}
  local xy = image.xsize / image.ysize
  if not width then
    width = height * xy / TEXpt
  end
  if not height then
    height = width / xy / TEXpt
  end
  local xsize = resolution * width / inch
  local ysize = resolution * height / inch
  if xsize < image.xsize or ysize < image.ysize then
    local s = format("gm convert -resize %dx%d %s %s",
                     xsize, ysize, oldname, newname)
    print("Conversion: " .. s)
    os.execute(s)
  else
    print(format("Nothing to do: %s, %s, %s", oldname, newname, resolution))
    print(format("xsize = %d, ysize = %d", xsize, ysize))
  end
end

local formats = {"png", "jpg", "gif"}

for _, s in ipairs(formats) do
  figures.converters[s] = figures.converters[s] or {}
  figures.converters[s]["lowres." .. s] = sample_down
end

[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15  6:56     ` Lutz Haseloff
  2019-02-15  7:24       ` Henning Hraban Ramm
@ 2019-02-15  7:25       ` Marco Patzer
  2019-02-15  9:22         ` Lutz Haseloff
  1 sibling, 1 reply; 23+ messages in thread
From: Marco Patzer @ 2019-02-15  7:25 UTC (permalink / raw)
  To: Lutz Haseloff; +Cc: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

On Fri, 15 Feb 2019 07:56:31 +0100
Lutz Haseloff <lutz.haseloff@toppkieker.info> wrote:

> First i tried the grph-downsample.lua script.
> Unfortunately i get an error message
> grph-downsample.lua:31: bad argument #2 to 'format' (number has no
> integer representation) See attached log file.

I remember that error. The script worked up to a particular context
version. I believe a Lua upgrade broke it. The version attached
should work.

Marco

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: t-downsample.lua --]
[-- Type: text/x-lua, Size: 1526 bytes --]

if not modules then modules = { } end modules ['t-downsample'] = {
  version   = 1.001,
  comment   = "companion to grph-inc.mkiv",
  author    = "Peter Münster",
  copyright = "PRAGMA ADE / ConTeXt Development Team",
  license   = "see context related readme files"
}

local format = string.format
-- figures.cachepaths.path = "cache" -- should be setup-option
local function sample_down(oldname, newname, resolution)
	local request = figures.current().request
	local width = request.width
	local height = request.height
	if resolution == "" or (not width and not height) then
		print(format("Nothing to do: %s, %s, %s", oldname, newname, resolution))
		return
	end
	local inch = 72.27
	local image = img.scan{filename = oldname}
	local xy = image.xsize / image.ysize
	if not width then
		width = height * xy / 65536
	end
	if not height then
		height = width / xy / 65536
	end
	local xsize = resolution * width / inch
	local ysize = resolution * height / inch
	if xsize < image.xsize or ysize < image.ysize then
		local s = format("gm convert -strip -resize %dx%d %s %s",
		xsize, ysize, oldname, newname)
		print("Conversion: " .. s)
		os.execute(s)
	else
		print(format("Nothing to do: %s, %s, %s", oldname, newname, resolution))
		print(format("xsize = %d, ysize = %d", xsize, ysize))
	end
end

local formats = {"png", "jpg", "gif"}

for _, s in ipairs(formats) do
	figures.converters[s] = figures.converters[s] or {}
	figures.converters[s]["lowres." .. s] = sample_down
end

[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15  7:25       ` Marco Patzer
@ 2019-02-15  9:22         ` Lutz Haseloff
  2019-02-15 10:08           ` Marco Patzer
  0 siblings, 1 reply; 23+ messages in thread
From: Lutz Haseloff @ 2019-02-15  9:22 UTC (permalink / raw)
  To: Context Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 922 bytes --]

Thank you Henning and Marco,

but both scripts trow the same error on windows and linux-armhf:

grph-downsample.lua:32: bad argument #2 to 'format' (number has no integer representation)

Hans' luacode seem not to change the resolution of the pictures at all.
It works, the size of the pictures get smaller but the resolution remains the same.

Greetings Lutz

Am 15. Februar 2019 08:25:35 MEZ schrieb Marco Patzer <lists@homerow.info>:
>On Fri, 15 Feb 2019 07:56:31 +0100
>Lutz Haseloff <lutz.haseloff@toppkieker.info> wrote:
>
>> First i tried the grph-downsample.lua script.
>> Unfortunately i get an error message
>> grph-downsample.lua:31: bad argument #2 to 'format' (number has no
>> integer representation) See attached log file.
>
>I remember that error. The script worked up to a particular context
>version. I believe a Lua upgrade broke it. The version attached
>should work.
>
>Marco

[-- Attachment #1.2: Type: text/html, Size: 1330 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15  9:22         ` Lutz Haseloff
@ 2019-02-15 10:08           ` Marco Patzer
  2019-02-15 10:48             ` Lutz Haseloff
  0 siblings, 1 reply; 23+ messages in thread
From: Marco Patzer @ 2019-02-15 10:08 UTC (permalink / raw)
  To: Lutz Haseloff; +Cc: mailing list for ConTeXt users

On Fri, 15 Feb 2019 10:22:48 +0100
Lutz Haseloff <lutz.haseloff@toppkieker.info> wrote:

> but both scripts trow the same error on windows and linux-armhf:
> 
> grph-downsample.lua:32: bad argument #2 to 'format' (number has no
> integer representation)

It works here on linux-armhf. No Lua error. Maybe the file got
mangled during transmission.

I've uploaded a modified version to github, maybe try that one:

  https://github.com/mpfusion/context-downsample

It includes a wrapper so you can call it like any other module
(\usemodule[downsample]). It's still Peter's code, but with small
modifications, so it degrades jpg as well as png images at the same
time. It's a quick hack, but works here, also on armhf.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15 10:08           ` Marco Patzer
@ 2019-02-15 10:48             ` Lutz Haseloff
  2019-02-15 11:23               ` Marco Patzer
  0 siblings, 1 reply; 23+ messages in thread
From: Lutz Haseloff @ 2019-02-15 10:48 UTC (permalink / raw)
  To: Context Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1055 bytes --]

Thanks Marco,
Your Module with wrapper finally works for me as expected.
Thank you very much.
Will it find its way into the distribution as an  enhanced degrade module?

Greetings ant thanks again

Lutz

Am 15. Februar 2019 11:08:45 MEZ schrieb Marco Patzer <lists@homerow.info>:
>On Fri, 15 Feb 2019 10:22:48 +0100
>Lutz Haseloff <lutz.haseloff@toppkieker.info> wrote:
>
>> but both scripts trow the same error on windows and linux-armhf:
>> 
>> grph-downsample.lua:32: bad argument #2 to 'format' (number has no
>> integer representation)
>
>It works here on linux-armhf. No Lua error. Maybe the file got
>mangled during transmission.
>
>I've uploaded a modified version to github, maybe try that one:
>
>  https://github.com/mpfusion/context-downsample
>
>It includes a wrapper so you can call it like any other module
>(\usemodule[downsample]). It's still Peter's code, but with small
>modifications, so it degrades jpg as well as png images at the same
>time. It's a quick hack, but works here, also on armhf.
>
>Marco

[-- Attachment #1.2: Type: text/html, Size: 1528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15 10:48             ` Lutz Haseloff
@ 2019-02-15 11:23               ` Marco Patzer
  2019-02-17 11:14                 ` Peter Münster
  0 siblings, 1 reply; 23+ messages in thread
From: Marco Patzer @ 2019-02-15 11:23 UTC (permalink / raw)
  To: Lutz Haseloff; +Cc: mailing list for ConTeXt users

On Fri, 15 Feb 2019 11:48:51 +0100
Lutz Haseloff <lutz.haseloff@toppkieker.info> wrote:

> Your Module with wrapper finally works for me as expected.

Great to hear it's finally working.

> Will it find its way into the distribution as an  enhanced degrade
> module?

Probably not, for the following reasons:

- It's 99% Peter's code, he's the maintainer of the module and
  probably he should just fix his code.

- My modification contains an ugly hack that just renames all files
  to pdf, regardless of the actual file type because I have no clue
  how to do that properly. That code shouldn't make it into the
  distribution.

- I'm not fluent in Lua and am therefore not the right person to
  maintain a Lua module.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-15 11:23               ` Marco Patzer
@ 2019-02-17 11:14                 ` Peter Münster
  2019-02-18  9:13                   ` Marco Patzer
  0 siblings, 1 reply; 23+ messages in thread
From: Peter Münster @ 2019-02-17 11:14 UTC (permalink / raw)
  To: ntg-context

On Fri, Feb 15 2019, Marco Patzer wrote:

> - It's 99% Peter's code, he's the maintainer of the module and
>   probably he should just fix his code.

Done.


> - My modification contains an ugly hack that just renames all files
>   to pdf, regardless of the actual file type because I have no clue
>   how to do that properly.

I've included your hack, because I don't have any better idea...


> That code shouldn't make it into the distribution.

Why not? Just because of the hack?

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-17 11:14                 ` Peter Münster
@ 2019-02-18  9:13                   ` Marco Patzer
  2019-02-18 10:03                     ` Peter Münster
  2019-02-18 15:25                     ` Alan Braslau
  0 siblings, 2 replies; 23+ messages in thread
From: Marco Patzer @ 2019-02-18  9:13 UTC (permalink / raw)
  To: ntg-context

On Sun, 17 Feb 2019 12:14:14 +0100
Peter Münster <pm@a16n.net> wrote:

> On Fri, Feb 15 2019, Marco Patzer wrote:
> 
> > - It's 99% Peter's code, he's the maintainer of the module and
> >   probably he should just fix his code.  
> 
> Done.
> 
> 
> > - My modification contains an ugly hack that just renames all files
> >   to pdf, regardless of the actual file type because I have no clue
> >   how to do that properly.  
> 
> I've included your hack, because I don't have any better idea...

ok

> > That code shouldn't make it into the distribution.  
> 
> Why not? Just because of the hack?

Yes. I didn't put much thought into it and assumed there is a better
solution.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18  9:13                   ` Marco Patzer
@ 2019-02-18 10:03                     ` Peter Münster
  2019-02-18 15:25                     ` Alan Braslau
  1 sibling, 0 replies; 23+ messages in thread
From: Peter Münster @ 2019-02-18 10:03 UTC (permalink / raw)
  To: ntg-context

On Mon, Feb 18 2019, Marco Patzer wrote:

> assumed there is a better solution.

I guess, that Hans will tell us, if there is. And in the meantime, it
can be distributed IMO.

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18  9:13                   ` Marco Patzer
  2019-02-18 10:03                     ` Peter Münster
@ 2019-02-18 15:25                     ` Alan Braslau
  2019-02-18 21:09                       ` Peter Münster
  1 sibling, 1 reply; 23+ messages in thread
From: Alan Braslau @ 2019-02-18 15:25 UTC (permalink / raw)
  To: Marco Patzer; +Cc: mailing list for ConTeXt users

On Mon, 18 Feb 2019 10:13:20 +0100
Marco Patzer <lists@homerow.info> wrote:

> Yes. I didn't put much thought into it and assumed there is a better
> solution.

My working solution is to put figures in subdirectories by resolution,
that is externally, once and for all, using whatever is your favorite tool
to "degrade" pixel resolution to whatever value one desires, then setting
global macro (\FigRes) to this subdirectory name.

So, for example,

\def\FigRes{300/}

...

\externalfigure [\FigRes MyFigureName]

I do this as I have *very* high resolution images as my source
(also high resolution "depth", i.e. 16 bit) and it makes no sense
to include these as is in my documents.

It's very robust.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18 15:25                     ` Alan Braslau
@ 2019-02-18 21:09                       ` Peter Münster
  2019-02-18 21:23                         ` Alan Braslau
  0 siblings, 1 reply; 23+ messages in thread
From: Peter Münster @ 2019-02-18 21:09 UTC (permalink / raw)
  To: ntg-context

On Mon, Feb 18 2019, Alan Braslau wrote:

> My working solution is to put figures in subdirectories by resolution,

The purpose of the downsample module is something else: a well defined
resolution of the image in the PDF-file. A bitmap image does not have a
resolution, only a width and a height in pixels. The resolution gets
defined, when you specify the real dimensions.

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18 21:09                       ` Peter Münster
@ 2019-02-18 21:23                         ` Alan Braslau
  2019-02-18 22:50                           ` Peter Münster
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Braslau @ 2019-02-18 21:23 UTC (permalink / raw)
  To: Peter Münster; +Cc: mailing list for ConTeXt users

On Mon, 18 Feb 2019 22:09:32 +0100
Peter Münster <pm@a16n.net> wrote:

> On Mon, Feb 18 2019, Alan Braslau wrote:
> 
> > My working solution is to put figures in subdirectories by resolution,  
> 
> The purpose of the downsample module is something else: a well defined
> resolution of the image in the PDF-file. A bitmap image does not have a
> resolution, only a width and a height in pixels. The resolution gets
> defined, when you specify the real dimensions.
> 

Incorrect, an image file contains width and height (in pixels) as well as a resolution, and the combination gives real dimensions (for a natural size).

A proper scan of a real object specifies all of this.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18 21:23                         ` Alan Braslau
@ 2019-02-18 22:50                           ` Peter Münster
  2019-02-18 23:21                             ` Alan Braslau
  0 siblings, 1 reply; 23+ messages in thread
From: Peter Münster @ 2019-02-18 22:50 UTC (permalink / raw)
  To: ntg-context

On Mon, Feb 18 2019, Alan Braslau wrote:

> Incorrect, an image file contains width and height (in pixels) as well as a
> resolution,

Optionally a resolution in the metadata. Then, of course, you have a
"natural size". But that doesn't matter, if you want other dimensions.

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18 22:50                           ` Peter Münster
@ 2019-02-18 23:21                             ` Alan Braslau
  2019-02-19  9:42                               ` Peter Münster
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Braslau @ 2019-02-18 23:21 UTC (permalink / raw)
  To: Peter Münster; +Cc: mailing list for ConTeXt users

On Mon, 18 Feb 2019 23:50:24 +0100
Peter Münster <pm@a16n.net> wrote:

> On Mon, Feb 18 2019, Alan Braslau wrote:
> 
> > Incorrect, an image file contains width and height (in pixels) as well as a
> > resolution,  
> 
> Optionally a resolution in the metadata. Then, of course, you have a
> "natural size". But that doesn't matter, if you want other dimensions.

For example, in Context

\externalfigure [myfigure]

should give this natural size. Of course, you can always specify other dimensions,
in which case it gets scaled. Since what counts for our use in Context is usually
fixing a particular size, i.e. [width=\textwidth], the "resolution", i.e. density
in pixels is something that we want to control. So if we want to print to 300 dpi,
for example, and we have a text width of 17cm, say, then we would like to have an
image that is some 2000 pixels in width. One can normalize one's collection of
images however one wishes, but manipulating them on the fly as one changes layout
or image placement hardly seems efficient, even if one were to be clever in storing
copies and looking at time stamps. A little bit of forethought might be better, and
more predictable.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: degrade module
  2019-02-18 23:21                             ` Alan Braslau
@ 2019-02-19  9:42                               ` Peter Münster
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Münster @ 2019-02-19  9:42 UTC (permalink / raw)
  To: ntg-context

On Mon, Feb 18 2019, Alan Braslau wrote:

> manipulating them on the fly as one changes layout or image placement
> hardly seems efficient,

Our use cases are perhaps different: in my case, manipulating them on
the fly automatically is *very* efficient.


> even if one were to be clever in storing copies and looking at time
> stamps.

ConTeXt does it already in grph-inc.lua, no need to be clever... ;)

-- 
           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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-02-19  9:42 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14 19:49 degrade module Lutz Haseloff
2019-02-14 20:22 ` Marco Patzer
2019-02-14 20:37   ` Peter Münster
2019-02-14 20:32 ` Peter Münster
2019-02-14 20:41   ` Wolfgang Schuster
2019-02-14 21:00     ` Peter Münster
2019-02-14 20:44   ` Hans Hagen
2019-02-15  6:56     ` Lutz Haseloff
2019-02-15  7:24       ` Henning Hraban Ramm
2019-02-15  7:25       ` Marco Patzer
2019-02-15  9:22         ` Lutz Haseloff
2019-02-15 10:08           ` Marco Patzer
2019-02-15 10:48             ` Lutz Haseloff
2019-02-15 11:23               ` Marco Patzer
2019-02-17 11:14                 ` Peter Münster
2019-02-18  9:13                   ` Marco Patzer
2019-02-18 10:03                     ` Peter Münster
2019-02-18 15:25                     ` Alan Braslau
2019-02-18 21:09                       ` Peter Münster
2019-02-18 21:23                         ` Alan Braslau
2019-02-18 22:50                           ` Peter Münster
2019-02-18 23:21                             ` Alan Braslau
2019-02-19  9:42                               ` Peter Münster

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).