summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/workflows/workflows-graphics.tex
blob: 55a8ad701e09fbe24f15df05a09860b459af46cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
% language=uk

\environment workflows-style

\startcomponent workflows-graphics

\startchapter[title=Graphics]

\startsection[title=Bad names]

After many years of using \CONTEXT\ in workflows where large amounts of source files
as well as graphics were involved we can safely say that it's hard for publishers to
control the way these are named. This is probably due to the fact that in a
click|-|and|-|point based desktop publishing workflow names don't matter as one stays on
one machine, and names are only entered once (after that these names become abstractions and
get cut and pasted). Proper consistent resource managament is simply not part of the flow.

This means that you get names like:

\starttyping
foo_Bar_01_03-a.EPS
foo__Bar-01a_03.eps
foo__Bar-01a_03.eps
foo BarA  01-03.eps
\stoptyping

Especially when a non proportional screen font is used multiple spaces can look
like one. In fancy screen fonts upper and lowercase usage might get obscured. It
really makes one wonder if copy|-|editing or adding labels to graphics isn't
suffering from the same problem.

Anyhow, as in an automated rendering workflow the rendering is often the last step you
can imagine that when names get messed up it's that last step that gets blamed. It's not
that hard to sanitize names of files on disk as well as in the files that refer to them,
and we normally do that we have complete control. This is no option when all the resources
are synchronzied from elsewhere. In that case the only way out is signaling potential
issues. Say that in the source file there is a reference:

\starttyping
foo_Bar_01_03-a.EPS
\stoptyping

and that the graphic on disk has the same name, but for some reason after an update
has become:

\starttyping
foo-Bar_01_03-a.EPS
\stoptyping

The old image is probably still there so the update is not reflected in the final
product. This is not that uncommon when you deal with tens of thousands of files,
many editors and graphic designers, and no strict filename policy.

For this we provide the following tracing option:

\starttyping
\enabletrackers[graphics.lognames]
\stoptyping

This will put information in the log file about included graphics, like:

\starttyping
system          > graphics > start names

used graphic    > asked   : cow.pdf
used graphic    > comment : not found
used graphic    > asked   : t:/sources/cow.pdf
used graphic    > format  : pdf
used graphic    > found   : t:/sources/cow.pdf
used graphic    > used    : t:/sources/cow.pdf

system          > graphics > stop names
\stoptyping

You can also add information to the file itself:

\starttyping
\usemodule[s-figures-names]
\stoptyping

Of course that has to be done at the end of the document. Bad names are reported
and suitable action can be taken.

\stopsection

\startsection[title=Downsampling]

You can plug in you rown converter, here is an example:

\starttyping
\startluacode

figures.converters.jpg = figures.converters.jpg or { }

figures.converters.jpg["lowresjpg.pdf"] =
  function(oldname,newname,resolution)
    figures.programs.run (
      [[gm]],
      [[convert -geometry %nx%x%ny% -compress JPEG "%old%" "%new%"]],
      {
         old = old,
         new = new,
         nx  = resolution or 300,
         ny  = resolution or 300,
      }
    )
  end
\stopluacode
\stoptyping

You can limit the search to a few types and set the resolution with:

\starttyping
\setupexternalfigures
  [order={pdf,jpg},
   resolution=100,
   method=auto]
\stoptyping

And use it like:

\starttyping
\externalfigure[verybig.jpg][height=10cm]
\stoptyping

The second string passed to the \type {run} helper contains the arguments to the
first one. The variables between percent signs get replaced by the variables in
the tables passed as third argument.

\stopsection

\startsection[title=Trackers]

If you want a lot of info you can say:

\starttyping
\enabletrackers[figures.*]
\stoptyping

But you can be more specific. With \type {graphics.locating} you will get some
insight in where files are looked for. The \type {graphics.inclusion} tracker
gives some more info about actual inclusion. The \type {graphics.bases} is kind
of special and only makes sense when you use the graphic database options. The
\type {graphics.conversion} and related tracker \type {graphics.programs} show if
and how conversion of images takes place.

The \type {graphics.lognames} will make sure that some extra information about
used graphics is saved in the log file, while \type {graphics.usage} will produce
a file \typ {<jobname>-figures-usage.lua} that contains information about found
(or not found) images and the way they are used.

\stopsection

\stopchapter

\stopcomponent