iptc 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/iptc.rb +3 -3
- data/lib/iptc/jpeg/image.rb +123 -100
- data/lib/iptc/jpeg/marker.rb +1 -1
- data/lib/iptc/jpeg/marker_headers.rb +66 -66
- data/lib/iptc/marker_nomenclature.rb +49 -49
- data/lib/iptc/marker_nomenclature_data.rb +63 -0
- data/lib/iptc/multiple_hash.rb +4 -1
- data/lib/iptc/version.rb +1 -1
- metadata +12 -9
data/lib/iptc.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
require 'iptc/jpeg/image'
|
|
2
|
-
require 'iptc/jpeg/markers'
|
|
3
|
-
|
|
1
|
+
require 'iptc/jpeg/image'
|
|
2
|
+
require 'iptc/jpeg/markers'
|
|
3
|
+
|
data/lib/iptc/jpeg/image.rb
CHANGED
|
@@ -1,100 +1,123 @@
|
|
|
1
|
-
require 'logger'
|
|
2
|
-
|
|
3
|
-
require 'iptc/multiple_hash'
|
|
4
|
-
require 'iptc/jpeg/marker_headers'
|
|
5
|
-
|
|
6
|
-
module IPTC
|
|
7
|
-
module JPEG
|
|
8
|
-
class Image
|
|
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
|
-
|
|
1
|
+
require 'logger'
|
|
2
|
+
|
|
3
|
+
require 'iptc/multiple_hash'
|
|
4
|
+
require 'iptc/jpeg/marker_headers'
|
|
5
|
+
|
|
6
|
+
module IPTC
|
|
7
|
+
module JPEG
|
|
8
|
+
class Image
|
|
9
|
+
# Array of MultipleHashItem objects
|
|
10
|
+
attr_reader :values
|
|
11
|
+
|
|
12
|
+
# creates a JPEG image from a data blob and does a "quick" load (Only the metadata
|
|
13
|
+
# are loaded, not the whole file).
|
|
14
|
+
def Image.from_blob blob, quick=true
|
|
15
|
+
return Image.new("Data blob", blob, true)
|
|
16
|
+
end
|
|
17
|
+
# creates a JPEG image from a file and does a "quick" load (Only the metadata
|
|
18
|
+
# are loaded, not the whole file).
|
|
19
|
+
def Image.from_file filename, quick=true
|
|
20
|
+
content = nil
|
|
21
|
+
raise "File #{filename} not found" if !File.exists?(filename)
|
|
22
|
+
File.open(filename) do |f|
|
|
23
|
+
f.binmode
|
|
24
|
+
content = f.read
|
|
25
|
+
end
|
|
26
|
+
return Image.new(filename, content, quick)
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
# Real constructor. Should never be called directly
|
|
30
|
+
# take a "data name" that is used for error reporting.
|
|
31
|
+
def initialize data_name, content, quick=true
|
|
32
|
+
@logger = Logger.new(STDOUT)
|
|
33
|
+
@logger.datetime_format = "%H:%M:%S"
|
|
34
|
+
@logger.level = Logger::DEBUG # $DEBUG?(Logger::DEBUG):(Logger::INFO)
|
|
35
|
+
|
|
36
|
+
@data_name = data_name
|
|
37
|
+
@content = content
|
|
38
|
+
|
|
39
|
+
@position = 0
|
|
40
|
+
|
|
41
|
+
if MARKERS[read(2)]!="SOI"
|
|
42
|
+
raise NotJPEGFileException.new("Not JPEG data: #{@data_name}")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
@markers = Array.new()
|
|
46
|
+
|
|
47
|
+
begin
|
|
48
|
+
|
|
49
|
+
catch(:end_of_metadata) do
|
|
50
|
+
while true
|
|
51
|
+
@markers << read_marker
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
rescue Exception=>e
|
|
56
|
+
@logger.info "Exception in data #{@data_name}:\n"+e.to_s
|
|
57
|
+
raise e
|
|
58
|
+
end
|
|
59
|
+
# Markers all read
|
|
60
|
+
# move back
|
|
61
|
+
seek(-2)
|
|
62
|
+
|
|
63
|
+
# in full mode, read the rest
|
|
64
|
+
if !quick
|
|
65
|
+
@data = read_rest
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
@values = MultipleHash.new
|
|
69
|
+
|
|
70
|
+
@markers.each do |marker|
|
|
71
|
+
# puts "processing marker: #{marker.inspect}"
|
|
72
|
+
marker.parse
|
|
73
|
+
# puts marker.valid?
|
|
74
|
+
@values.add(marker, marker.values)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def read(count)
|
|
79
|
+
@position += count
|
|
80
|
+
return @content[@position-count...@position]
|
|
81
|
+
end
|
|
82
|
+
def seek(count)
|
|
83
|
+
@position += count
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def l message
|
|
87
|
+
@logger.debug message
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# write the image to the disk
|
|
91
|
+
def write data_name
|
|
92
|
+
f = File.open(data_name,"wb+")
|
|
93
|
+
f.print "\xFF\xD8"
|
|
94
|
+
|
|
95
|
+
@markers.each do |marker|
|
|
96
|
+
f.print marker.to_binary
|
|
97
|
+
end
|
|
98
|
+
f.print @data.to_binary
|
|
99
|
+
f.close
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def read_marker
|
|
104
|
+
type = read(2)
|
|
105
|
+
# finished reading all the metadata
|
|
106
|
+
throw :end_of_metadata if MARKERS[type]=='SOS'
|
|
107
|
+
size = read(2)
|
|
108
|
+
data = read(size.unpack('n')[0]-2)
|
|
109
|
+
|
|
110
|
+
return Marker.NewMarker(MARKERS[type], type+size+data, @logger)
|
|
111
|
+
end
|
|
112
|
+
def read_rest
|
|
113
|
+
rest = @content[@position..-1]
|
|
114
|
+
return Marker.new("BIN",rest)
|
|
115
|
+
end
|
|
116
|
+
def to_s
|
|
117
|
+
"Image #{@data_name}:\n" +
|
|
118
|
+
@markers.map{ |m| m.to_s }.join("\n")
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
data/lib/iptc/jpeg/marker.rb
CHANGED
|
@@ -14,7 +14,7 @@ module IPTC
|
|
|
14
14
|
# Inspect the object space in order to find something usable later
|
|
15
15
|
def Marker.NewMarker(type,data, logger)
|
|
16
16
|
marker_class = "#{type}Marker"
|
|
17
|
-
if JPEG::Markers.constants.include?(marker_class.
|
|
17
|
+
if JPEG::Markers.constants.include?(marker_class.to_s)
|
|
18
18
|
return JPEG::Markers.const_get(marker_class).new(type, data)
|
|
19
19
|
else
|
|
20
20
|
if !@@missing.include?(type)
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
module IPTC
|
|
2
|
-
module JPEG
|
|
3
|
-
MARKERS = {
|
|
4
|
-
"\xFF\xD8" => 'SOI',
|
|
5
|
-
"\xFF\xc0" => 'SOF0',
|
|
6
|
-
"\xFF\xc1" => 'SOF1',
|
|
7
|
-
"\xFF\xc2" => 'SOF2',
|
|
8
|
-
"\xFF\xc3" => 'SOF3',
|
|
9
|
-
|
|
10
|
-
"\xFF\xc5" => 'SOF5',
|
|
11
|
-
"\xFF\xc6" => 'SOF6',
|
|
12
|
-
"\xFF\xc7" => 'SOF7',
|
|
13
|
-
|
|
14
|
-
"\xFF\xc8" => 'JPG',
|
|
15
|
-
"\xFF\xc9" => 'SOF9',
|
|
16
|
-
"\xFF\xca" => 'SOF10',
|
|
17
|
-
"\xFF\xcb" => 'SOF11',
|
|
18
|
-
|
|
19
|
-
"\xFF\xcd" => 'SOF13',
|
|
20
|
-
"\xFF\xce" => 'SOF14',
|
|
21
|
-
"\xFF\xcf" => 'SOF15',
|
|
22
|
-
|
|
23
|
-
"\xFF\xc4" => 'DHT',
|
|
24
|
-
|
|
25
|
-
"\xFF\xcc" => 'DAC',
|
|
26
|
-
|
|
27
|
-
"\xFF\xd0" => 'RST0',
|
|
28
|
-
"\xFF\xd1" => 'RST1',
|
|
29
|
-
"\xFF\xd2" => 'RST2',
|
|
30
|
-
"\xFF\xd3" => 'RST3',
|
|
31
|
-
"\xFF\xd4" => 'RST4',
|
|
32
|
-
"\xFF\xd5" => 'RST5',
|
|
33
|
-
"\xFF\xd6" => 'RST6',
|
|
34
|
-
"\xFF\xd7" => 'RST7',
|
|
35
|
-
|
|
36
|
-
"\xFF\xd8" => 'SOI',
|
|
37
|
-
"\xFF\xd9" => 'EOI',
|
|
38
|
-
"\xFF\xda" => 'SOS',
|
|
39
|
-
"\xFF\xdb" => 'DQT',
|
|
40
|
-
"\xFF\xdc" => 'DNL',
|
|
41
|
-
"\xFF\xdd" => 'DRI',
|
|
42
|
-
"\xFF\xde" => 'DHP',
|
|
43
|
-
"\xFF\xdf" => 'EXP',
|
|
44
|
-
|
|
45
|
-
"\xFF\xe0" => 'APP0',
|
|
46
|
-
"\xFF\xe1" => 'APP1',
|
|
47
|
-
"\xFF\xe2" => 'APP2',
|
|
48
|
-
"\xFF\xe3" => 'APP3',
|
|
49
|
-
"\xFF\xe4" => 'APP4',
|
|
50
|
-
"\xFF\xe5" => 'APP5',
|
|
51
|
-
"\xFF\xe6" => 'APP6',
|
|
52
|
-
"\xFF\xe7" => 'APP7',
|
|
53
|
-
"\xFF\xe8" => 'APP8',
|
|
54
|
-
"\xFF\xe9" => 'APP9',
|
|
55
|
-
"\xFF\xea" => 'APP10',
|
|
56
|
-
"\xFF\xeb" => 'APP11',
|
|
57
|
-
"\xFF\xec" => 'APP12',
|
|
58
|
-
"\xFF\xed" => 'APP13',
|
|
59
|
-
"\xFF\xee" => 'APP14',
|
|
60
|
-
"\xFF\xef" => 'APP15',
|
|
61
|
-
"\xFF\xf0" => 'JPG0',
|
|
62
|
-
"\xFF\xfd" => 'JPG13',
|
|
63
|
-
"\xFF\xfe" => 'COM',
|
|
64
|
-
"\xFF\x01" => 'TEM'
|
|
65
|
-
}
|
|
66
|
-
end
|
|
1
|
+
module IPTC
|
|
2
|
+
module JPEG
|
|
3
|
+
MARKERS = {
|
|
4
|
+
"\xFF\xD8" => 'SOI',
|
|
5
|
+
"\xFF\xc0" => 'SOF0',
|
|
6
|
+
"\xFF\xc1" => 'SOF1',
|
|
7
|
+
"\xFF\xc2" => 'SOF2',
|
|
8
|
+
"\xFF\xc3" => 'SOF3',
|
|
9
|
+
|
|
10
|
+
"\xFF\xc5" => 'SOF5',
|
|
11
|
+
"\xFF\xc6" => 'SOF6',
|
|
12
|
+
"\xFF\xc7" => 'SOF7',
|
|
13
|
+
|
|
14
|
+
"\xFF\xc8" => 'JPG',
|
|
15
|
+
"\xFF\xc9" => 'SOF9',
|
|
16
|
+
"\xFF\xca" => 'SOF10',
|
|
17
|
+
"\xFF\xcb" => 'SOF11',
|
|
18
|
+
|
|
19
|
+
"\xFF\xcd" => 'SOF13',
|
|
20
|
+
"\xFF\xce" => 'SOF14',
|
|
21
|
+
"\xFF\xcf" => 'SOF15',
|
|
22
|
+
|
|
23
|
+
"\xFF\xc4" => 'DHT',
|
|
24
|
+
|
|
25
|
+
"\xFF\xcc" => 'DAC',
|
|
26
|
+
|
|
27
|
+
"\xFF\xd0" => 'RST0',
|
|
28
|
+
"\xFF\xd1" => 'RST1',
|
|
29
|
+
"\xFF\xd2" => 'RST2',
|
|
30
|
+
"\xFF\xd3" => 'RST3',
|
|
31
|
+
"\xFF\xd4" => 'RST4',
|
|
32
|
+
"\xFF\xd5" => 'RST5',
|
|
33
|
+
"\xFF\xd6" => 'RST6',
|
|
34
|
+
"\xFF\xd7" => 'RST7',
|
|
35
|
+
|
|
36
|
+
"\xFF\xd8" => 'SOI',
|
|
37
|
+
"\xFF\xd9" => 'EOI',
|
|
38
|
+
"\xFF\xda" => 'SOS',
|
|
39
|
+
"\xFF\xdb" => 'DQT',
|
|
40
|
+
"\xFF\xdc" => 'DNL',
|
|
41
|
+
"\xFF\xdd" => 'DRI',
|
|
42
|
+
"\xFF\xde" => 'DHP',
|
|
43
|
+
"\xFF\xdf" => 'EXP',
|
|
44
|
+
|
|
45
|
+
"\xFF\xe0" => 'APP0',
|
|
46
|
+
"\xFF\xe1" => 'APP1',
|
|
47
|
+
"\xFF\xe2" => 'APP2',
|
|
48
|
+
"\xFF\xe3" => 'APP3',
|
|
49
|
+
"\xFF\xe4" => 'APP4',
|
|
50
|
+
"\xFF\xe5" => 'APP5',
|
|
51
|
+
"\xFF\xe6" => 'APP6',
|
|
52
|
+
"\xFF\xe7" => 'APP7',
|
|
53
|
+
"\xFF\xe8" => 'APP8',
|
|
54
|
+
"\xFF\xe9" => 'APP9',
|
|
55
|
+
"\xFF\xea" => 'APP10',
|
|
56
|
+
"\xFF\xeb" => 'APP11',
|
|
57
|
+
"\xFF\xec" => 'APP12',
|
|
58
|
+
"\xFF\xed" => 'APP13',
|
|
59
|
+
"\xFF\xee" => 'APP14',
|
|
60
|
+
"\xFF\xef" => 'APP15',
|
|
61
|
+
"\xFF\xf0" => 'JPG0',
|
|
62
|
+
"\xFF\xfd" => 'JPG13',
|
|
63
|
+
"\xFF\xfe" => 'COM',
|
|
64
|
+
"\xFF\x01" => 'TEM'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
67
|
end
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
require 'singleton'
|
|
2
|
-
require 'iptc/marker'
|
|
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
|
-
end
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
require 'singleton'
|
|
2
|
+
require 'iptc/marker'
|
|
3
|
+
require 'iptc/marker_nomenclature_data'
|
|
4
|
+
|
|
5
|
+
require 'yaml'
|
|
6
|
+
|
|
7
|
+
module IPTC
|
|
8
|
+
class MarkerNomenclature
|
|
9
|
+
include Singleton
|
|
10
|
+
def MarkerNomenclature.markers(id)
|
|
11
|
+
return MarkerNomenclature.instance.markers(id)
|
|
12
|
+
end
|
|
13
|
+
def markers_count
|
|
14
|
+
@markers.keys.length
|
|
15
|
+
end
|
|
16
|
+
def markers(id)
|
|
17
|
+
if @markers.has_key?(id)
|
|
18
|
+
return @markers[id]
|
|
19
|
+
else
|
|
20
|
+
return @markers[-1]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def populate
|
|
25
|
+
@markers = {}
|
|
26
|
+
|
|
27
|
+
marker = Struct.new(:iid, :name, :description)
|
|
28
|
+
|
|
29
|
+
m = marker.new
|
|
30
|
+
m.name = "Unknown marker"
|
|
31
|
+
m.iid = -1
|
|
32
|
+
@markers[-1] = m
|
|
33
|
+
|
|
34
|
+
NOMENCLATURE.each_line do |line|
|
|
35
|
+
m = marker.new
|
|
36
|
+
m[:name], m[:description], m[:iid] = line.split(/\t/)
|
|
37
|
+
m[:iid] = m[:iid].to_i
|
|
38
|
+
@markers[m.iid] = m
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
def benchmark
|
|
42
|
+
require 'benchmark'
|
|
43
|
+
Benchmark.bm(40) do |x|
|
|
44
|
+
x.report("Populate Markers") { 1000.times do populate(); end }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
IPTC::MarkerNomenclature.instance.populate
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module IPTC
|
|
2
|
+
class MarkerNomenclature
|
|
3
|
+
NOMENCLATURE=<<-EOS
|
|
4
|
+
RecordVersion Version of IIM part 2 0 0x0000 Yes No 2 2 Iptc.Application2.RecordVersion
|
|
5
|
+
ObjectType IIM appendix G object type 3 0x0003 No No 3 67 Iptc.Application2.ObjectType
|
|
6
|
+
ObjectAttribute IIM appendix G object attribute 4 0x0004 No Yes 4 68 Iptc.Application2.ObjectAttribute
|
|
7
|
+
ObjectName Shorthand reference of content 5 0x0005 No No 0 64 Iptc.Application2.ObjectName
|
|
8
|
+
EditStatus Content status 7 0x0007 No No 0 64 Iptc.Application2.EditStatus
|
|
9
|
+
EditorialUpdate Indicates the type of update 8 0x0008 No No 2 2 Iptc.Application2.EditorialUpdate
|
|
10
|
+
Urgency Editorial urgency of content 10 0x000a No No 1 1 Iptc.Application2.Urgency
|
|
11
|
+
Subject Structured definition of the subject 12 0x000c No Yes 13 236 Iptc.Application2.Subject
|
|
12
|
+
Category Identifies the subject 15 0x000f No No 0 3 Iptc.Application2.Category
|
|
13
|
+
SuppCategory Refines the subject 20 0x0014 No Yes 0 32 Iptc.Application2.SuppCategory
|
|
14
|
+
FixtureId Identifies content that recurs 22 0x0016 No No 0 32 Iptc.Application2.FixtureId
|
|
15
|
+
Keywords Information retrieval words 25 0x0019 No Yes 0 64 Iptc.Application2.Keywords
|
|
16
|
+
LocationCode ISO country code for content 26 0x001a No Yes 3 3 Iptc.Application2.LocationCode
|
|
17
|
+
LocationName Full country name for content 27 0x001b No Yes 0 64 Iptc.Application2.LocationName
|
|
18
|
+
ReleaseDate Earliest intended usable date 30 0x001e No No 8 8 Iptc.Application2.ReleaseDate
|
|
19
|
+
ReleaseTime Earliest intended usable time 35 0x0023 No No 11 11 Iptc.Application2.ReleaseTime
|
|
20
|
+
ExpirationDate Latest intended usable date 37 0x0025 No No 8 8 Iptc.Application2.ExpirationDate
|
|
21
|
+
ExpirationTime Latest intended usable time 38 0x0026 No No 11 11 Iptc.Application2.ExpirationTime
|
|
22
|
+
SpecialInstructions Editorial usage instructions 40 0x0028 No No 0 256 Iptc.Application2.SpecialInstructions
|
|
23
|
+
ActionAdvised Action provided to previous data 42 0x002a No No 2 2 Iptc.Application2.ActionAdvised
|
|
24
|
+
ReferenceService Service Identifier of a prior envelope 45 0x002d No Yes 0 10 Iptc.Application2.ReferenceService
|
|
25
|
+
ReferenceDate Date of a prior envelope 47 0x002f No Yes 8 8 Iptc.Application2.ReferenceDate
|
|
26
|
+
ReferenceNumber Envelope Number of a prior envelope 50 0x0032 No Yes 8 8 Iptc.Application2.ReferenceNumber
|
|
27
|
+
DateCreated Creation date of intellectual content 55 0x0037 No No 8 8 Iptc.Application2.DateCreated
|
|
28
|
+
TimeCreated Creation time of intellectual content 60 0x003c No No 11 11 Iptc.Application2.TimeCreated
|
|
29
|
+
DigitizationDate Creation date of digital representation 62 0x003e No No 8 8 Iptc.Application2.DigitizationDate
|
|
30
|
+
DigitizationTime Creation time of digital representation 63 0x003f No No 11 11 Iptc.Application2.DigitizationTime
|
|
31
|
+
Program Content creation program 65 0x0041 No No 0 32 Iptc.Application2.Program
|
|
32
|
+
ProgramVersion Content creation program version 70 0x0046 No No 0 10 Iptc.Application2.ProgramVersion
|
|
33
|
+
ObjectCycle Morning 75 0x004b No No 1 1 Iptc.Application2.ObjectCycle
|
|
34
|
+
Byline Name of content creator 80 0x0050 No Yes 0 32 Iptc.Application2.Byline
|
|
35
|
+
BylineTitle Title of content creator 85 0x0055 No Yes 0 32 Iptc.Application2.BylineTitle
|
|
36
|
+
City City of content origin 90 0x005a No No 0 32 Iptc.Application2.City
|
|
37
|
+
SubLocation Location within city 92 0x005c No No 0 32 Iptc.Application2.SubLocation
|
|
38
|
+
ProvinceState Province/State of content origin 95 0x005f No No 0 32 Iptc.Application2.ProvinceState
|
|
39
|
+
CountryCode ISO country code of content origin 100 0x0064 No No 3 3 Iptc.Application2.CountryCode
|
|
40
|
+
CountryName Full country name of content origin 101 0x0065 No No 0 64 Iptc.Application2.CountryName
|
|
41
|
+
TransmissionReference Location of original transmission 103 0x0067 No No 0 32 Iptc.Application2.TransmissionReference
|
|
42
|
+
Headline Content synopsis 105 0x0069 No No 0 256 Iptc.Application2.Headline
|
|
43
|
+
Credit Content provider 110 0x006e No No 0 32 Iptc.Application2.Credit
|
|
44
|
+
Source Original owner of content 115 0x0073 No No 0 32 Iptc.Application2.Source
|
|
45
|
+
Copyright Necessary copyright notice 116 0x0074 No No 0 128 Iptc.Application2.Copyright
|
|
46
|
+
Contact Person or organisation to contact 118 0x0076 No Yes 0 128 Iptc.Application2.Contact
|
|
47
|
+
Caption Content description 120 0x0078 No No 0 2000 Iptc.Application2.Caption
|
|
48
|
+
Writer Person responsible for caption 122 0x007a No Yes 0 32 Iptc.Application2.Writer
|
|
49
|
+
RasterizedCaption Black and white caption image 125 0x007d No No 7360 7360 Iptc.Application2.RasterizedCaption
|
|
50
|
+
ImageType Color components in an image 130 0x0082 No No 2 2 Iptc.Application2.ImageType
|
|
51
|
+
ImageOrientation Indicates the layout of an image 131 0x0083 No No 1 1 Iptc.Application2.ImageOrientation
|
|
52
|
+
Language ISO 639:1988 language code 135 0x0087 No No 2 3 Iptc.Application2.Language
|
|
53
|
+
AudioType Information about audio content 150 0x0096 No No 2 2 Iptc.Application2.AudioType
|
|
54
|
+
AudioRate Sampling rate of audio content 151 0x0097 No No 6 6 Iptc.Application2.AudioRate
|
|
55
|
+
AudioResolution Sampling resolution of audio content 152 0x0098 No No 2 2 Iptc.Application2.AudioResolution
|
|
56
|
+
AudioDuration Duration of audio content 153 0x0099 No No 6 6 Iptc.Application2.AudioDuration
|
|
57
|
+
AudioOutcue Final words or sounds of audio content 154 0x009a No No 0 64 Iptc.Application2.AudioOutcue
|
|
58
|
+
PreviewFormat IIM appendix A file format of preview 200 0x00c8 No No 2 2 Iptc.Application2.PreviewFormat
|
|
59
|
+
PreviewVersion File format version of preview 201 0x00c9 No No 2 2 Iptc.Application2.PreviewVersion
|
|
60
|
+
Preview Binary preview data 202 0x00ca No No 0 256000 Iptc.Application2.Preview
|
|
61
|
+
EOS
|
|
62
|
+
end
|
|
63
|
+
end
|
data/lib/iptc/multiple_hash.rb
CHANGED
|
@@ -3,6 +3,9 @@ module IPTC
|
|
|
3
3
|
|
|
4
4
|
# a MultipleHash associate a String key, a Marker Object and a String value
|
|
5
5
|
# this object
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# This structure is too complicated.
|
|
6
9
|
class MultipleHash
|
|
7
10
|
def initialize()
|
|
8
11
|
@internal = Hash.new
|
|
@@ -51,4 +54,4 @@ module IPTC
|
|
|
51
54
|
end
|
|
52
55
|
end
|
|
53
56
|
|
|
54
|
-
end
|
|
57
|
+
end
|
data/lib/iptc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iptc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 25
|
|
5
|
+
prerelease:
|
|
5
6
|
segments:
|
|
6
7
|
- 0
|
|
7
8
|
- 0
|
|
8
|
-
-
|
|
9
|
-
version: 0.0.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.0.3
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- Pierre Baillet
|
|
@@ -15,13 +16,13 @@ autorequire:
|
|
|
15
16
|
bindir: bin
|
|
16
17
|
cert_chain: []
|
|
17
18
|
|
|
18
|
-
date:
|
|
19
|
+
date: 2011-09-23 00:00:00 +02:00
|
|
19
20
|
default_executable:
|
|
20
21
|
dependencies: []
|
|
21
22
|
|
|
22
|
-
description: Original code from http://raa.ruby-lang.org/project/jpeg-jfif-iptc/, gemified and updated by Jens Kraemer
|
|
23
|
+
description: Original code from http://raa.ruby-lang.org/project/jpeg-jfif-iptc/, gemified and updated by Jens Kraemer, Futher fixes by Pierre Baillet
|
|
23
24
|
email:
|
|
24
|
-
-
|
|
25
|
+
- pierre@baillet.name
|
|
25
26
|
executables: []
|
|
26
27
|
|
|
27
28
|
extensions: []
|
|
@@ -35,13 +36,14 @@ files:
|
|
|
35
36
|
- lib/iptc/jpeg/markers.rb
|
|
36
37
|
- lib/iptc/marker.rb
|
|
37
38
|
- lib/iptc/marker_nomenclature.rb
|
|
39
|
+
- lib/iptc/marker_nomenclature_data.rb
|
|
38
40
|
- lib/iptc/multiple_hash.rb
|
|
39
41
|
- lib/iptc/version.rb
|
|
40
42
|
- lib/iptc.rb
|
|
41
43
|
- LICENSE
|
|
42
44
|
- README.md
|
|
43
45
|
has_rdoc: true
|
|
44
|
-
homepage: http://github.com/
|
|
46
|
+
homepage: http://github.com/octplane/ruby-iptc
|
|
45
47
|
licenses: []
|
|
46
48
|
|
|
47
49
|
post_install_message:
|
|
@@ -54,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
54
56
|
requirements:
|
|
55
57
|
- - ">="
|
|
56
58
|
- !ruby/object:Gem::Version
|
|
57
|
-
hash:
|
|
59
|
+
hash: 3
|
|
58
60
|
segments:
|
|
59
61
|
- 0
|
|
60
62
|
version: "0"
|
|
@@ -63,6 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
63
65
|
requirements:
|
|
64
66
|
- - ">="
|
|
65
67
|
- !ruby/object:Gem::Version
|
|
68
|
+
hash: 23
|
|
66
69
|
segments:
|
|
67
70
|
- 1
|
|
68
71
|
- 3
|
|
@@ -71,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
74
|
requirements: []
|
|
72
75
|
|
|
73
76
|
rubyforge_project: ruby-iptc
|
|
74
|
-
rubygems_version: 1.
|
|
77
|
+
rubygems_version: 1.6.2
|
|
75
78
|
signing_key:
|
|
76
79
|
specification_version: 3
|
|
77
80
|
summary: Pure ruby IPTC metadata reader
|