assembly-image 1.6.8 → 1.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OGE0YzJiODk5NThlM2U1OTU1YjM2N2VhMzY1MTFiNmZhZWI2ZTBkNA==
5
- data.tar.gz: !binary |-
6
- OWE0YzZiMDMyNDM0MDc4NTM5NzNjNzdiYWQ5YzQwZjQ5ZWFkZDE4Ng==
2
+ SHA1:
3
+ metadata.gz: 6d66d9eec1f29d5bd46dc1d0b56e5dabedc9bdb7
4
+ data.tar.gz: e1ca05e2d6fc53ab1d636693eff5adc5c904f2e8
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZjlhNmFiMmQxNDdlMjc2NTgzMTIzYmYxMWRlNGExZTQwNzY2NzI2ZGQwMzEx
10
- ZWU5ZjRjNzMxZmIzODBkYWY1NzM1NTg5ZDJkMWFlMTRmYjliNmZhMTVhNmJl
11
- OTQ0ZWY1YTBhYzQ2ZTgwNGZjYzU5ODgwNGNmZGUyNWMyNDI4MzE=
12
- data.tar.gz: !binary |-
13
- ODQxM2Y0ODBhNzk2YTkwZDA2NTIyZWIxMzlkNTQ4ZDdhN2VhZmVkZTY2MTdh
14
- NDljNGI5MDk0YjI4OTQ2MmRkM2I1YzJhMDg2YTJiNzI1OWE2NWViMGI4MjBj
15
- MmRhYjJlMDcyOTZkNTVkZGE1YWYwY2Q1NTg3MjRkMmY2ZjNkNDA=
6
+ metadata.gz: 8cee672d311df902bf6a6f922c6f0d34836970eef4df48cd6535f9533ad5dfe22c198fcac8d6ea6d2549d64d8a33010752bf7e2ddc903dd264a801627ac66c47
7
+ data.tar.gz: 6ef377f1d9135287313582ffdbbe7daa605a18a3ff4a8e4efe5b1025fbb239db5d0c1545ba72a508d0f242fb9a28d26f37e332210c11fe3cf58694f14d07c621
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,13 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ # rspec expect{...} is conventional
4
+ Style/SpaceBeforeBlockBraces:
5
+ Exclude:
6
+ - 'spec/**/*_spec.rb'
7
+
8
+ Style/EmptyLineBetweenDefs:
9
+ AllowAdjacentOneLineDefs: true
10
+
11
+ # Configuration parameters: AllowURI, URISchemes.
12
+ Metrics/LineLength:
13
+ Max: 200
@@ -0,0 +1,263 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-12-15 16:19:20 -0800 using RuboCop version 0.35.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 11
10
+ # Cop supports --auto-correct.
11
+ Lint/DeprecatedClassMethods:
12
+ Exclude:
13
+ - 'lib/assembly-image/image.rb'
14
+ - 'spec/image_spec.rb'
15
+ - 'spec/spec_helper.rb'
16
+
17
+ # Offense count: 2
18
+ Lint/RescueException:
19
+ Exclude:
20
+ - 'lib/assembly-image/image.rb'
21
+ - 'lib/assembly-image/images.rb'
22
+
23
+ # Offense count: 2
24
+ # Cop supports --auto-correct.
25
+ Lint/StringConversionInInterpolation:
26
+ Exclude:
27
+ - 'lib/assembly-image/image.rb'
28
+
29
+ # Offense count: 2
30
+ Lint/UselessAssignment:
31
+ Exclude:
32
+ - 'config/boot.rb'
33
+ - 'lib/assembly-image/images.rb'
34
+
35
+ # Offense count: 4
36
+ Metrics/AbcSize:
37
+ Max: 87
38
+
39
+ # Offense count: 2
40
+ Metrics/CyclomaticComplexity:
41
+ Max: 29
42
+
43
+ # Offense count: 2
44
+ # Configuration parameters: AllowURI, URISchemes.
45
+ Metrics/LineLength:
46
+ Max: 244
47
+
48
+ # Offense count: 5
49
+ # Configuration parameters: CountComments.
50
+ Metrics/MethodLength:
51
+ Max: 59
52
+
53
+ # Offense count: 2
54
+ Metrics/PerceivedComplexity:
55
+ Max: 30
56
+
57
+ # Offense count: 2
58
+ # Cop supports --auto-correct.
59
+ # Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
60
+ Style/CaseIndentation:
61
+ Enabled: false
62
+
63
+ # Offense count: 1
64
+ # Configuration parameters: Exclude.
65
+ Style/Documentation:
66
+ Exclude:
67
+ - 'spec/**/*'
68
+ - 'test/**/*'
69
+ - 'lib/assembly-image.rb'
70
+
71
+ # Offense count: 1
72
+ # Cop supports --auto-correct.
73
+ Style/EmptyLines:
74
+ Exclude:
75
+ - 'spec/images_spec.rb'
76
+
77
+ # Offense count: 4
78
+ # Cop supports --auto-correct.
79
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
80
+ Style/EmptyLinesAroundBlockBody:
81
+ Exclude:
82
+ - 'spec/image_spec.rb'
83
+ - 'spec/images_spec.rb'
84
+
85
+ # Offense count: 2
86
+ # Cop supports --auto-correct.
87
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
88
+ Style/EmptyLinesAroundClassBody:
89
+ Exclude:
90
+ - 'lib/assembly-image/image.rb'
91
+
92
+ # Offense count: 2
93
+ # Cop supports --auto-correct.
94
+ Style/EmptyLinesAroundMethodBody:
95
+ Exclude:
96
+ - 'lib/assembly-image/image.rb'
97
+ - 'lib/assembly-image/images.rb'
98
+
99
+ # Offense count: 13
100
+ # Cop supports --auto-correct.
101
+ # Configuration parameters: AllowForAlignment.
102
+ Style/ExtraSpacing:
103
+ Exclude:
104
+ - 'lib/assembly-image/image.rb'
105
+ - 'spec/images_spec.rb'
106
+ - 'spec/spec_helper.rb'
107
+
108
+ # Offense count: 1
109
+ # Configuration parameters: Exclude.
110
+ Style/FileName:
111
+ Exclude:
112
+ - 'lib/assembly-image.rb'
113
+
114
+ # Offense count: 1
115
+ # Configuration parameters: MinBodyLength.
116
+ Style/GuardClause:
117
+ Exclude:
118
+ - 'spec/spec_helper.rb'
119
+
120
+ # Offense count: 31
121
+ # Cop supports --auto-correct.
122
+ # Configuration parameters: SupportedStyles, UseHashRocketsWithSymbolValues.
123
+ Style/HashSyntax:
124
+ EnforcedStyle: hash_rockets
125
+
126
+ # Offense count: 1
127
+ # Cop supports --auto-correct.
128
+ # Configuration parameters: Width.
129
+ Style/IndentationWidth:
130
+ Exclude:
131
+ - 'lib/assembly-image/images.rb'
132
+
133
+ # Offense count: 2
134
+ # Cop supports --auto-correct.
135
+ Style/LineEndConcatenation:
136
+ Exclude:
137
+ - 'lib/assembly-image/image.rb'
138
+
139
+ # Offense count: 1
140
+ # Cop supports --auto-correct.
141
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
142
+ Style/MethodDefParentheses:
143
+ Enabled: false
144
+
145
+ # Offense count: 2
146
+ # Cop supports --auto-correct.
147
+ Style/NegatedIf:
148
+ Exclude:
149
+ - 'lib/assembly-image/image.rb'
150
+
151
+ # Offense count: 2
152
+ # Cop supports --auto-correct.
153
+ # Configuration parameters: PreferredDelimiters.
154
+ Style/PercentLiteralDelimiters:
155
+ Exclude:
156
+ - 'assembly-image.gemspec'
157
+
158
+ # Offense count: 1
159
+ # Cop supports --auto-correct.
160
+ Style/RedundantBegin:
161
+ Exclude:
162
+ - 'lib/assembly-image/image.rb'
163
+
164
+ # Offense count: 1
165
+ # Cop supports --auto-correct.
166
+ # Configuration parameters: AllowAsExpressionSeparator.
167
+ Style/Semicolon:
168
+ Exclude:
169
+ - 'spec/spec_helper.rb'
170
+
171
+ # Offense count: 14
172
+ # Cop supports --auto-correct.
173
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
174
+ Style/SignalException:
175
+ Exclude:
176
+ - 'lib/assembly-image/image.rb'
177
+ - 'lib/assembly-image/images.rb'
178
+ - 'spec/spec_helper.rb'
179
+
180
+ # Offense count: 4
181
+ # Cop supports --auto-correct.
182
+ Style/SingleSpaceBeforeFirstArg:
183
+ Exclude:
184
+ - 'spec/images_spec.rb'
185
+
186
+ # Offense count: 93
187
+ # Cop supports --auto-correct.
188
+ Style/SpaceAfterComma:
189
+ Exclude:
190
+ - 'assembly-image.gemspec'
191
+ - 'lib/assembly-image/image.rb'
192
+ - 'lib/assembly-image/images.rb'
193
+ - 'spec/image_spec.rb'
194
+ - 'spec/images_spec.rb'
195
+ - 'spec/spec_helper.rb'
196
+
197
+ # Offense count: 4
198
+ # Cop supports --auto-correct.
199
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
200
+ Style/SpaceAroundEqualsInParameterDefault:
201
+ Enabled: false
202
+
203
+ # Offense count: 54
204
+ # Cop supports --auto-correct.
205
+ # Configuration parameters: MultiSpaceAllowedForOperators.
206
+ Style/SpaceAroundOperators:
207
+ Exclude:
208
+ - 'lib/assembly-image.rb'
209
+ - 'lib/assembly-image/image.rb'
210
+ - 'lib/assembly-image/images.rb'
211
+ - 'spec/image_spec.rb'
212
+ - 'spec/images_spec.rb'
213
+ - 'spec/spec_helper.rb'
214
+
215
+ # Offense count: 1
216
+ # Cop supports --auto-correct.
217
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
218
+ Style/SpaceBeforeBlockBraces:
219
+ Enabled: false
220
+
221
+ # Offense count: 29
222
+ # Cop supports --auto-correct.
223
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
224
+ Style/SpaceInsideBlockBraces:
225
+ Enabled: false
226
+
227
+ # Offense count: 4
228
+ # Cop supports --auto-correct.
229
+ Style/SpaceInsideParens:
230
+ Exclude:
231
+ - 'lib/assembly-image/image.rb'
232
+
233
+ # Offense count: 5
234
+ # Cop supports --auto-correct.
235
+ Style/SpecialGlobalVars:
236
+ Exclude:
237
+ - 'lib/assembly-image/image.rb'
238
+ - 'spec/spec_helper.rb'
239
+
240
+ # Offense count: 87
241
+ # Cop supports --auto-correct.
242
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
243
+ Style/StringLiterals:
244
+ Enabled: false
245
+
246
+ # Offense count: 1
247
+ # Cop supports --auto-correct.
248
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
249
+ Style/TrivialAccessors:
250
+ Exclude:
251
+ - 'lib/assembly-image/images.rb'
252
+
253
+ # Offense count: 2
254
+ # Cop supports --auto-correct.
255
+ Style/UnneededPercentQ:
256
+ Exclude:
257
+ - 'assembly-image.gemspec'
258
+
259
+ # Offense count: 11
260
+ # Cop supports --auto-correct.
261
+ # Configuration parameters: WordRegex.
262
+ Style/WordArray:
263
+ MinSize: 3
@@ -0,0 +1,26 @@
1
+ notifications:
2
+ email: false
3
+
4
+ rvm:
5
+ - 2.2.4
6
+
7
+ language: ruby
8
+ sudo: false
9
+
10
+ before_install:
11
+ - cmake --version
12
+ - wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
13
+ install:
14
+ - cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip
15
+ - export LD_LIBRARY_PATH=${PWD}/KDU77_Demo_Apps_for_Linux-x86-64_150710:${LD_LIBRARY_PATH}
16
+ - export PATH=${PWD}/KDU77_Demo_Apps_for_Linux-x86-64_150710:${PATH}
17
+ - bundle install --jobs=3 --retry=3
18
+
19
+ addons:
20
+ apt:
21
+ packages:
22
+ - libimage-exiftool-perl
23
+
24
+ env:
25
+ global:
26
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
- source "http://rubygems.org"
2
- source "http://sul-gems.stanford.edu"
1
+ source 'http://rubygems.org'
3
2
 
4
3
  # Specify your gem's dependencies in assembly-image.gemspec
5
4
  gemspec
@@ -0,0 +1,158 @@
1
+ [![Build Status](https://travis-ci.org/sul-dlss/assembly-image.svg?branch=master)](https://travis-ci.org/sul-dlss/assembly-image)
2
+
3
+ # Assembly Image Gem
4
+
5
+ ## Overview
6
+ This gem contains classes used by the Stanford University Digital Library to
7
+ perform image operations necessary for accessioning of content.
8
+
9
+ ## Releases
10
+
11
+ * 0.0.1 initial release
12
+ * 0.0.2 small bug fixes
13
+ * 0.0.3 more bug fixes
14
+ * 0.0.4 update jp2 creation method to restrict allowed input types and improve color profile handling
15
+ * 0.0.5 updated documentation to yard format
16
+ * 0.0.6 updated dependency declarations
17
+ * 0.1.0 move color profile extraction to tmp folder instead of gem profiles folder
18
+ * 0.1.1 fix problem with digest require statement
19
+ * 0.1.2 move check for file existence to when an action occurs instead of object initialization; more error checking and messages on command execution
20
+ * 0.1.3 added a filesize attribute to the file object to allow easy access to filesize in bytes
21
+ * 0.1.4 added a new images class that allows you batch create jp2s from an input TIFF directory
22
+ * 0.2.0 added a new method to the image class to handle TIFF "sanity-check" -- can be used to ensure TIFFs are valid before JP2 generation
23
+ * 1.0.0 bump the version number up to an official production level release
24
+ * 1.1.0 remove common object file behaviors to a separate gem and use that gem as a dependency
25
+ * 1.1.1 minor changes to spec tests
26
+ * 1.1.2 remove the addition of 'format' node to file types in content metadata generation
27
+ * 1.1.3 changes to content metadata generation method: change md5 and sha1 computations so that they come from the assembly-objectfile gem,
28
+ and set preserve/publish/shelve attributes using mimetype defaults
29
+ * 1.2.0 support tiffs that have embedded thumbnails when creating jp2
30
+ * 1.2.1 raise a SecurityError if the user attempts to overwrite an existing jp2 when creating it, to make it easier to catch in assembly
31
+ * 1.2.2 add height and width methods for an image that gets it from exif
32
+ * 1.2.4 prepare for release listing on DLSS release board
33
+ * 1.2.5 small change to use the jp2able method instead of the valid? method when creating jp2s
34
+ * 1.2.6 update how version number is set to make it easier to show
35
+ * 1.3.0 added a new method to the Assembly::Images class to allow for batch adding of color profiles to all tiffs in a directory; allow batch methods to run recursively
36
+ * 1.3.1 remove content metadata generation method and add to assembly-objectfile gem instead
37
+ * 1.3.3 update gemspec to force use of latest assembly-objectfile gem to allow gem to work in Ruby 1.9 projects
38
+ * 1.3.4 update to latest version of lyberteam gems
39
+ * 1.3.5 fix a problem that could occur if there were spaces in input filenames
40
+ * 1.3.6 add new attribute to give you default jp2 filename that will be used
41
+ * 1.3.7 add new attribute to give you default dpg jp2 filename
42
+ * 1.3.8 allow for batch processing of image extensions other than tif
43
+ * 1.3.9 create new methods for getting a color profile from exif and for force adding color profile to a single image
44
+ * 1.4.0 and 1.4.1 set the imagemagick tmp folder location environment variable when creating jp2
45
+ * 1.5.0 allow images with a color profile to have jp2 derivatives generated
46
+ * 1.5.1 relax nokogiri version requirement
47
+ * 1.6.1 bump version number of assembly-objectfile required to fix UTF-8 errors during JP2-create
48
+ * 1.6.2-1.6.3 small change to jp2 generation to try and fix bug with tiffs that have multiple input profile layers
49
+ * 1.6.4 added in some additional checks to try and create jp2s with mismatching exif data
50
+ * 1.6.5 fix problem with lack of extension in incoming tif causing a problem when creating jp2
51
+ * 1.6.7 release to github/rubygems
52
+ * 1.6.9 update mini_exiftool
53
+
54
+ ## Notes
55
+
56
+ 1. The gem assumes that the user context in which it is executed has write access to the 'tmp' folder.
57
+ This is because color profiles can be extracted from images during the JP2
58
+ creation process, and these profiles need to be stored as local files, and it
59
+ is beneficial to cache them for later usage by images with the same color profile.
60
+ If you know there are color profiles which are commonly used, it is better to
61
+ capture them in the gem itself in the profile folder so they can be re-used
62
+ and do not need to be extracted.
63
+ 1. If any errors occur during JP2 generation for any reason, a runtime exception will be thrown with a description of the error.
64
+ 2. If an image is passed in with a color profile that cannot be determined by examining the exif header data, an exception will be thrown.
65
+
66
+ This can commonly occur in basic test TIFs that are black/white and have no profile, so beware during testing.
67
+
68
+ ## Usage
69
+
70
+ To use the JP2 creation method, you first instantiate the image object with an input image and then operate on it.
71
+
72
+ ```ruby
73
+ require 'assembly-image'
74
+ input = Assembly::Image.new('/full/path/to/file.tif')
75
+ puts input.exif # show exif header information for the TIF
76
+ output = input.create_jp2(:output=>'/full/path/to/output.jp2') # generate a new JP2 in the specified location
77
+ puts output.exif # show exif header information for the JP2
78
+ ```
79
+
80
+ ## Running tests
81
+
82
+ ```bash
83
+ bundle exec rake
84
+ ```
85
+
86
+ ## Generate documentation
87
+ To generate documentation into the "doc" folder:
88
+
89
+ ```bash
90
+ yard
91
+ ```
92
+
93
+ To keep a local server running with up to date code documentation that you can view in your browser:
94
+
95
+ ```bash
96
+ yard server --reload
97
+ ```
98
+
99
+ ## Prerequisites
100
+
101
+ 1. Perl - you probably already have it
102
+ 2. Kakadu Proprietary Software Binaries - for JP2 generation
103
+ 3. ImageMagick 6.5.4 or higher
104
+ 4. Exiftool
105
+
106
+ ### Kakadu
107
+
108
+ Download and install demonstration binaries from Kakadu:
109
+ http://kakadusoftware.com/downloads/
110
+
111
+ NOTE: If you have upgrade to El Capitan on OS X, you will need to donwload and re-install the latest version of Kakadu, due to changes made with SIP. These changes moved the old executable binaries to an inaccessible location.
112
+
113
+ ### Imagemagick
114
+
115
+ #### RHEL 6
116
+
117
+ The version of ImageMagick included with RHEL 6 has all of the dependency libraries included:
118
+
119
+ ```bash
120
+ yum install ImageMagick
121
+ ```
122
+ #### RHEL 5
123
+
124
+ The version of ImageMagick included with RHEL 5 is too old and does not have all the proper binaries included/built:
125
+
126
+ ```bash
127
+ yum install lcms lcms-devel libjpeg libjpeg-devel libpng libpng-devel
128
+ ```
129
+ Required libraries from source:
130
+ * libtiff (version 3.9.4 or higher)
131
+
132
+ Build Imagemagick from source:
133
+ http://www.imagemagick.org/download/ImageMagick.tar.gz
134
+
135
+ #### Mac
136
+
137
+ ```bash
138
+ brew install jasper libtiff
139
+ brew install imagemagick --use-tiff --use-jpeg2000
140
+ ```
141
+
142
+ ### Exiftool
143
+
144
+ #### RHEL
145
+ Download latest version from: http://www.sno.phy.queensu.ca/~phil/exiftool
146
+
147
+ ```bash
148
+ tar -xf Image-ExifTool-#.##.tar.gz
149
+ cd Image-ExifTool-#.##
150
+ perl Makefile.PL
151
+ make test
152
+ sudo make install
153
+ ```
154
+
155
+ #### Mac
156
+ ```bash
157
+ brew install exiftool
158
+ ```