Check-in [18e13a77f5]

Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:TIP 529: Add metadata dict property to tk photo image
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:18e13a77f57291adeac414f724424ef608ae9b0d2112ad5f634294f42ac68777
User & Date: oehhar 2018-12-07 11:01:21
Original Comment: TIP 528: Add metadata dict property to tk photo image
Context
2018-12-11
07:43
Correct tip number in title. Be more verbose on script contents. check-in: bd622aab21 user: oehhar tags: trunk
2018-12-07
11:01
TIP 529: Add metadata dict property to tk photo image check-in: 18e13a77f5 user: oehhar tags: trunk
2018-12-06
13:57
Tk-version -> Tcl-version check-in: 70b1f60628 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to index.json.

1

2
3
4
5
6
7
8
...
525
526
527
528
529
530
531
532
533
{"tip": {

	"528":{"url":"./tip/528.md","created":"05-Dec-2018","post-history":"","state":"Draft","tk-branch":"offsetof","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 528: Deprecate Tk_Offset()","author":["Jan Nijtmans <jan.nijtmans@gmail.com>"],"is-jest":false},
	"527":{"url":"./tip/527.md","created":"26-Nov-2018","post-history":"","state":"Draft","tcl-branch":"sebres-8-6-timerate","tcl-version":"8.5","vote":"Pending","type":"Project","title":"# TIP 527: New measurement facilities in TCL: New command timerate.","discussions-to":"news:comp.lang.tcl","author":["Sergey G. Brester <sebres@users.sourceforge.net>"],"is-jest":false},
	"526":{"url":"./tip/526.md","created":"08-Nov-2018","post-history":"","state":"Draft","tcl-version":"9.0","vote":"Pending","type":"Project","title":"# TIP 526: Make [expr] Only Accept One Argument","author":["Donal K. Fellows <donal.k.fellows@manchester.ac.uk>"],"is-jest":false},
	"525":{"url":"./tip/525.md","keywords":"Tcl, testing, continuous integration","state":"Final","type":"Project","author":["Donal K. Fellows <donal.k.fellows@manchester.ac.uk>"],"vote-results":"8/0/0 accepted","votes-for":"KBK, SL, AF, DGP, FV, DKF, AK, JN","votes-against":"none","created":"24-Oct-2018","title":"# TIP 525: Make Tcltest Report Overall Success in a Machine-Readable Way","post-history":"","vote":"Done","tcl-version":"8.5","votes-present":"none","is-jest":false},
	"524":{"url":"./tip/524.md","keywords":"Tcl, object orientation, customization","state":"Final","vote-summary":"Accepted 2/0/4","type":"Project","author":["Donal K. Fellows <donal.k.fellows@manchester.ac.uk>"],"votes-against":"none","votes-for":"DKF, JN","created":"23-Oct-2018","title":"# TIP 524: Custom Definition Dialects for TclOO","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-524","votes-present":"BG, KBK, FV, SL","is-jest":false},
	"523":{"url":"./tip/523.md","keywords":"queue, stack, pop","state":"Final","vote-summary":"Accepted 7/0/0","type":"Project","author":["Peter Spjuth <peter.spjuth@gmail.com>"],"votes-against":"none","votes-for":"DKF, BG, KBK, JN, DGP, FV, SL","created":"22-Oct-2018","title":"# TIP 523: New lpop command","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-523","votes-present":"none","is-jest":false},
	"522":{"url":"./tip/522.md","keywords":"tcltest, error codes","state":"Final","type":"Project","author":["Peter Spjuth <peter.spjuth@gmail.com>"],"vote-results":"8/0/0 accepted","votes-for":"KBK, SL, AF, DGP, FV, DKF, AK, JN","votes-against":"none","created":"22-Oct-2018","title":"# TIP 522: Test error codes with Tcltest","post-history":"","tcl-branch":"tip-522","vote":"Done","tcl-version":"8.7","votes-present":"none","is-jest":false},
................................................................................
	"5":{"url":"./tip/5.md","created":"17-Oct-2000","post-history":"","state":"Final","vote":"Done","tcl-version":"8.4","type":"Project","title":"# TIP 5: Make TkClassProcs and TkSetClassProcs Public and Extensible","author":["Eric Melski <ericm@ajubasolutions.com>"],"is-jest":false},
	"4":{"url":"./tip/4.md","created":"26-Oct-2000","post-history":"","state":"Draft","vote":"Pending","type":"Informative","title":"# TIP 4: Tcl Release and Distribution Philosophy","discussions-to":"news:comp.lang.tcl","author":["Brent Welch <welch@acm.org>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Larry W. Virden <lvirden@cas.org>","Larry W. Virden <lvirden@yahoo.com>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>"],"is-jest":false},
	"2":{"url":"./tip/2.md","created":"12-Sep-2000","post-history":"","state":"Draft","vote":"Pending","type":"Process","title":"# TIP 2: TIP Guidelines","author":["Andreas Kupries <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Don Porter <dgp@users.sourceforge.net>","Mo DeJong <no@spam.com>","Larry W. Virden <lvirden@yahoo.com>","Kevin Kenny <kennykb@acm.org>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","post-history":"","state":"Active","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <donal.fellows@cs.man.ac.uk>"],"is-jest":false},
	"0":{"url":"./tip/0.md","created":"11-Dec-2000","post-history":"","state":"Final","vote":"Done","type":"Process","title":"# TIP 0: Tcl Core Team Basic Rules","author":["John Ousterhout <ouster@pacbell.net>"],"is-jest":false},
	"@min": 0,
	"@max": 528
}, "@timestamp": 1544104622}

>







 







|
|
1
2
3
4
5
6
7
8
9
...
526
527
528
529
530
531
532
533
534
{"tip": {
	"529":{"url":"./tip/529.md","keywords":"Tk, image","created":"07-Dec-2018","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 528: Add metadata dict property to tk photo image","author":["Harald Oehlmann <oehhar@users.sourceforge.net>"],"is-jest":false},
	"528":{"url":"./tip/528.md","created":"05-Dec-2018","post-history":"","state":"Draft","tk-branch":"offsetof","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 528: Deprecate Tk_Offset()","author":["Jan Nijtmans <jan.nijtmans@gmail.com>"],"is-jest":false},
	"527":{"url":"./tip/527.md","created":"26-Nov-2018","post-history":"","state":"Draft","tcl-branch":"sebres-8-6-timerate","tcl-version":"8.5","vote":"Pending","type":"Project","title":"# TIP 527: New measurement facilities in TCL: New command timerate.","discussions-to":"news:comp.lang.tcl","author":["Sergey G. Brester <sebres@users.sourceforge.net>"],"is-jest":false},
	"526":{"url":"./tip/526.md","created":"08-Nov-2018","post-history":"","state":"Draft","tcl-version":"9.0","vote":"Pending","type":"Project","title":"# TIP 526: Make [expr] Only Accept One Argument","author":["Donal K. Fellows <donal.k.fellows@manchester.ac.uk>"],"is-jest":false},
	"525":{"url":"./tip/525.md","keywords":"Tcl, testing, continuous integration","state":"Final","type":"Project","author":["Donal K. Fellows <donal.k.fellows@manchester.ac.uk>"],"vote-results":"8/0/0 accepted","votes-for":"KBK, SL, AF, DGP, FV, DKF, AK, JN","votes-against":"none","created":"24-Oct-2018","title":"# TIP 525: Make Tcltest Report Overall Success in a Machine-Readable Way","post-history":"","vote":"Done","tcl-version":"8.5","votes-present":"none","is-jest":false},
	"524":{"url":"./tip/524.md","keywords":"Tcl, object orientation, customization","state":"Final","vote-summary":"Accepted 2/0/4","type":"Project","author":["Donal K. Fellows <donal.k.fellows@manchester.ac.uk>"],"votes-against":"none","votes-for":"DKF, JN","created":"23-Oct-2018","title":"# TIP 524: Custom Definition Dialects for TclOO","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-524","votes-present":"BG, KBK, FV, SL","is-jest":false},
	"523":{"url":"./tip/523.md","keywords":"queue, stack, pop","state":"Final","vote-summary":"Accepted 7/0/0","type":"Project","author":["Peter Spjuth <peter.spjuth@gmail.com>"],"votes-against":"none","votes-for":"DKF, BG, KBK, JN, DGP, FV, SL","created":"22-Oct-2018","title":"# TIP 523: New lpop command","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-523","votes-present":"none","is-jest":false},
	"522":{"url":"./tip/522.md","keywords":"tcltest, error codes","state":"Final","type":"Project","author":["Peter Spjuth <peter.spjuth@gmail.com>"],"vote-results":"8/0/0 accepted","votes-for":"KBK, SL, AF, DGP, FV, DKF, AK, JN","votes-against":"none","created":"22-Oct-2018","title":"# TIP 522: Test error codes with Tcltest","post-history":"","tcl-branch":"tip-522","vote":"Done","tcl-version":"8.7","votes-present":"none","is-jest":false},
................................................................................
	"5":{"url":"./tip/5.md","created":"17-Oct-2000","post-history":"","state":"Final","vote":"Done","tcl-version":"8.4","type":"Project","title":"# TIP 5: Make TkClassProcs and TkSetClassProcs Public and Extensible","author":["Eric Melski <ericm@ajubasolutions.com>"],"is-jest":false},
	"4":{"url":"./tip/4.md","created":"26-Oct-2000","post-history":"","state":"Draft","vote":"Pending","type":"Informative","title":"# TIP 4: Tcl Release and Distribution Philosophy","discussions-to":"news:comp.lang.tcl","author":["Brent Welch <welch@acm.org>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Larry W. Virden <lvirden@cas.org>","Larry W. Virden <lvirden@yahoo.com>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>"],"is-jest":false},
	"2":{"url":"./tip/2.md","created":"12-Sep-2000","post-history":"","state":"Draft","vote":"Pending","type":"Process","title":"# TIP 2: TIP Guidelines","author":["Andreas Kupries <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Don Porter <dgp@users.sourceforge.net>","Mo DeJong <no@spam.com>","Larry W. Virden <lvirden@yahoo.com>","Kevin Kenny <kennykb@acm.org>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","post-history":"","state":"Active","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <donal.fellows@cs.man.ac.uk>"],"is-jest":false},
	"0":{"url":"./tip/0.md","created":"11-Dec-2000","post-history":"","state":"Final","vote":"Done","type":"Process","title":"# TIP 0: Tcl Core Team Basic Rules","author":["John Ousterhout <ouster@pacbell.net>"],"is-jest":false},
	"@min": 0,
	"@max": 529
}, "@timestamp": 1544180393}

Changes to index.md.

116
117
118
119
120
121
122








123
124
125
126
127
128
129
<th>Type</th>
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
<th>Impl.</th>
</tr></thead><tbody>









<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/528.md'>528</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 528: Deprecate Tk_Offset()</td>
<td valign='top'><a href='/tk/timeline?r=offsetof'>Link</a></td>







>
>
>
>
>
>
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<th>Type</th>
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
<th>Impl.</th>
</tr></thead><tbody>

<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/529.md'>529</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 528: Add metadata dict property to tk photo image</td>
<td></td>
</tr>
<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/528.md'>528</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 528: Deprecate Tk_Offset()</td>
<td valign='top'><a href='/tk/timeline?r=offsetof'>Link</a></td>

Added tip/529.md.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
# TIP 528: Add metadata dict property to tk photo image
	Author:         Harald Oehlmann <oehhar@users.sourceforge.net>
	State:          Draft
	Type:           Project
	Vote:           Pending
	Created:        07-Dec-2018
	Keywords:       Tk, image
	Tcl-Version:    8.7
-----

# Abstract

An additional property is proposed for photo images to hold image metadata:

    myimage cget -metadata
    myimage configure -metadata [dict create dpi 300.0]


# Rationale

Image files may contain a lot of metadata like resolution, comments, GPS location etc.
This metadata should be accessable and setable for the following aims:

   *   Make it available after image load on script level
   *   Make it setable within the image
   *   Write it in the image file.
   *   Prepare eventual automations on automatic scaling on screen resolution

This TIP specially targets the resolution (DPI) value of the image.

The image resolution included in an image file is crucial for its usage, as many applications (word & co.) use this field to calculate a default size.
One may enjoy, that image files used in pdf4tcl are automatically scaled at the right resolution (e.g. the resolution saved in the image file).

This information is included in png files (supported by tk core) and many other image formats included in the Img patch.

I authored an extension to the Img patch to specify the dpi field of a bmp file on file writing. The syntax was accorded with Jeff Hobbs:

    myimage write file.bmp -format [list bmp -resolution 300 i]

This may be expressed (when all packages are adopted) by:

    myimage configure -metadata [dict create dpi 300.0]
    myimage write file.bmp

# Specification

## Metadata dict

The propery "-metadata" is added to each image file.
It contains a dict, where the keys are specified for each image format.

The following default keys are used, if the corresponding data is present:

| key     | description      | example image formats |
|:-------:|:----------------:|:---------------------:|
| dpi     | Image resolution | png                   |
| comment | Text comment     | gif                   |
| xmp     | xmp image data   | png                   |

## Commands

The following commands are directly concerned:

    image create photo myimage -metadata $metadict
    myimage cget -metadata
    myimage configure -metadata $metadict

Any load and save command may implicitly use the content of the metadata dict.
This may be an ongoing process, specially within the Img patch.

The commands are:

    image create photo myimage -file myfile.bmp
    myimage configure -file myfile.bmp
    myimage write file.bmp

# Implementation

The current implementation is only a sketch in my brain.
I hope, that an image handler can set the options after reading and a binary extension of the image handlers is not necessary.
Nevertheless, I don't know jet.

Any help and comments are appreciated.
I am realy a novice here.

Implementation may start soon with the tag tip-529-image-metadata.

# Copyright

This document has been placed in the public domain.