assembly-image 1.7.8 → 1.8.0
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.
- checksums.yaml +4 -4
- data/README.md +0 -47
- data/lib/assembly-image/version.rb +1 -1
- data/spec/image_spec.rb +32 -32
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab0138b7a2f4b92d23428f192efd67f9db79e588849411265079c7dafbd8d44b
|
4
|
+
data.tar.gz: 6d87bd7214d36684259de8d082b75494f67602947df1bfbb992ae7d4178a339c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1afdaef9ca647be48084fd50ea18adcb69383b42e5cccea155f5dbb5ed072709ca6061f0b0f352df738ff2a0a4d55388a5e2288f6fbb8eab97c166a3f5ed6f0
|
7
|
+
data.tar.gz: e4310e4e33f402cefd3443173b47510ae6b1bb767be766f88edf934c802da7778866ad0e4b557254d6599a82b48f8e4f52fd50d9baf01ed0df430ad99cb8993f
|
data/README.md
CHANGED
@@ -9,53 +9,6 @@
|
|
9
9
|
This gem contains classes used by the Stanford University Digital Library to
|
10
10
|
perform image operations necessary for accessioning of content.
|
11
11
|
|
12
|
-
## Releases
|
13
|
-
|
14
|
-
* 0.0.1 initial release
|
15
|
-
* 0.0.2 small bug fixes
|
16
|
-
* 0.0.3 more bug fixes
|
17
|
-
* 0.0.4 update jp2 creation method to restrict allowed input types and improve color profile handling
|
18
|
-
* 0.0.5 updated documentation to yard format
|
19
|
-
* 0.0.6 updated dependency declarations
|
20
|
-
* 0.1.0 move color profile extraction to tmp folder instead of gem profiles folder
|
21
|
-
* 0.1.1 fix problem with digest require statement
|
22
|
-
* 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
|
23
|
-
* 0.1.3 added a filesize attribute to the file object to allow easy access to filesize in bytes
|
24
|
-
* 0.1.4 added a new images class that allows you batch create jp2s from an input TIFF directory
|
25
|
-
* 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
|
26
|
-
* 1.0.0 bump the version number up to an official production level release
|
27
|
-
* 1.1.0 remove common object file behaviors to a separate gem and use that gem as a dependency
|
28
|
-
* 1.1.1 minor changes to spec tests
|
29
|
-
* 1.1.2 remove the addition of 'format' node to file types in content metadata generation
|
30
|
-
* 1.1.3 changes to content metadata generation method: change md5 and sha1 computations so that they come from the assembly-objectfile gem,
|
31
|
-
and set preserve/publish/shelve attributes using mimetype defaults
|
32
|
-
* 1.2.0 support tiffs that have embedded thumbnails when creating jp2
|
33
|
-
* 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
|
34
|
-
* 1.2.2 add height and width methods for an image that gets it from exif
|
35
|
-
* 1.2.4 prepare for release listing on DLSS release board
|
36
|
-
* 1.2.5 small change to use the jp2able method instead of the valid? method when creating jp2s
|
37
|
-
* 1.2.6 update how version number is set to make it easier to show
|
38
|
-
* 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
|
39
|
-
* 1.3.1 remove content metadata generation method and add to assembly-objectfile gem instead
|
40
|
-
* 1.3.3 update gemspec to force use of latest assembly-objectfile gem to allow gem to work in Ruby 1.9 projects
|
41
|
-
* 1.3.4 update to latest version of lyberteam gems
|
42
|
-
* 1.3.5 fix a problem that could occur if there were spaces in input filenames
|
43
|
-
* 1.3.6 add new attribute to give you default jp2 filename that will be used
|
44
|
-
* 1.3.7 add new attribute to give you default dpg jp2 filename
|
45
|
-
* 1.3.8 allow for batch processing of image extensions other than tif
|
46
|
-
* 1.3.9 create new methods for getting a color profile from exif and for force adding color profile to a single image
|
47
|
-
* 1.4.0 and 1.4.1 set the imagemagick tmp folder location environment variable when creating jp2
|
48
|
-
* 1.5.0 allow images with a color profile to have jp2 derivatives generated
|
49
|
-
* 1.5.1 relax nokogiri version requirement
|
50
|
-
* 1.6.1 bump version number of assembly-objectfile required to fix UTF-8 errors during JP2-create
|
51
|
-
* 1.6.2-1.6.3 small change to jp2 generation to try and fix bug with tiffs that have multiple input profile layers
|
52
|
-
* 1.6.4 added in some additional checks to try and create jp2s with mismatching exif data
|
53
|
-
* 1.6.5 fix problem with lack of extension in incoming tif causing a problem when creating jp2
|
54
|
-
* 1.6.7 release to github/rubygems
|
55
|
-
* 1.6.9 update mini_exiftool
|
56
|
-
* 1.7.1 for jp2, only transcode to tiff if not a tiff
|
57
|
-
* 1.7.3 for jp2, only transcode to tiff if not an uncompressed tiff
|
58
|
-
|
59
12
|
## Notes
|
60
13
|
|
61
14
|
1. The gem assumes that the user context in which it is executed has write access to the 'tmp' folder.
|
data/spec/image_spec.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Assembly::Image do
|
6
|
-
let(:
|
6
|
+
let(:assembly_image) { described_class.new(input_path) }
|
7
7
|
let(:input_path) { TEST_TIF_INPUT_FILE }
|
8
8
|
|
9
9
|
after do
|
@@ -14,14 +14,14 @@ RSpec.describe Assembly::Image do
|
|
14
14
|
|
15
15
|
describe '#jp2_filename' do
|
16
16
|
it 'indicates the default jp2 filename' do
|
17
|
-
expect(
|
17
|
+
expect(assembly_image.jp2_filename).to eq TEST_TIF_INPUT_FILE.gsub('.tif', '.jp2')
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with a file with no extension' do
|
21
21
|
let(:input_path) { '/path/to/a/file_with_no_extension' }
|
22
22
|
|
23
23
|
it 'indicates the default jp2 filename' do
|
24
|
-
expect(
|
24
|
+
expect(assembly_image.jp2_filename).to eq '/path/to/a/file_with_no_extension.jp2'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -31,7 +31,7 @@ RSpec.describe Assembly::Image do
|
|
31
31
|
let(:input_path) { TEST_DPG_TIF_INPUT_FILE }
|
32
32
|
|
33
33
|
it 'indicates the default DPG jp2 filename' do
|
34
|
-
expect(
|
34
|
+
expect(assembly_image.dpg_jp2_filename).to eq TEST_DPG_TIF_INPUT_FILE.gsub('.tif', '.jp2').gsub('_00_', '_05_')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -39,7 +39,7 @@ RSpec.describe Assembly::Image do
|
|
39
39
|
let(:input_path) { '/path/to/a/file_with_no_00_extension' }
|
40
40
|
|
41
41
|
it 'indicates the default jp2 filename' do
|
42
|
-
expect(
|
42
|
+
expect(assembly_image.dpg_jp2_filename).to eq '/path/to/a/file_with_no_05_extension.jp2'
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -49,7 +49,7 @@ RSpec.describe Assembly::Image do
|
|
49
49
|
let(:input_path) { '' }
|
50
50
|
|
51
51
|
it 'does not run if no input file is passed in' do
|
52
|
-
expect {
|
52
|
+
expect { assembly_image.create_jp2 }.to raise_error
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -61,8 +61,8 @@ RSpec.describe Assembly::Image do
|
|
61
61
|
it 'creates the jp2 with a temp file' do
|
62
62
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
63
63
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
64
|
-
result =
|
65
|
-
expect(
|
64
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
65
|
+
expect(assembly_image.tmp_path).not_to be_nil
|
66
66
|
expect(result).to be_a_kind_of described_class
|
67
67
|
expect(result.path).to eq TEST_JP2_OUTPUT_FILE
|
68
68
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
@@ -81,8 +81,8 @@ RSpec.describe Assembly::Image do
|
|
81
81
|
it 'creates the jp2 with a temp file' do
|
82
82
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
83
83
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
84
|
-
result =
|
85
|
-
expect(
|
84
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
85
|
+
expect(assembly_image.tmp_path).not_to be_nil
|
86
86
|
expect(result).to be_a_kind_of described_class
|
87
87
|
expect(result.path).to eq TEST_JP2_OUTPUT_FILE
|
88
88
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
@@ -102,7 +102,7 @@ RSpec.describe Assembly::Image do
|
|
102
102
|
it 'creates grayscale jp2' do
|
103
103
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
104
104
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
105
|
-
result =
|
105
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
106
106
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
107
107
|
expect(result.exif.colorspace).to eq 'Grayscale'
|
108
108
|
end
|
@@ -116,8 +116,8 @@ RSpec.describe Assembly::Image do
|
|
116
116
|
it 'creates color jp2' do
|
117
117
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
118
118
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
119
|
-
expect(
|
120
|
-
result =
|
119
|
+
expect(assembly_image).not_to have_color_profile
|
120
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
121
121
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
122
122
|
expect(result.exif.colorspace).to eq 'sRGB'
|
123
123
|
end
|
@@ -131,8 +131,8 @@ RSpec.describe Assembly::Image do
|
|
131
131
|
it 'creates grayscale jp2' do
|
132
132
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
133
133
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
134
|
-
expect(
|
135
|
-
result =
|
134
|
+
expect(assembly_image).not_to have_color_profile
|
135
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
136
136
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
137
137
|
expect(result.exif.colorspace).to eq 'Grayscale'
|
138
138
|
end
|
@@ -146,8 +146,8 @@ RSpec.describe Assembly::Image do
|
|
146
146
|
it 'creates color jp2' do
|
147
147
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
148
148
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
149
|
-
expect(
|
150
|
-
result =
|
149
|
+
expect(assembly_image).not_to have_color_profile
|
150
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
151
151
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
152
152
|
expect(result.exif.colorspace).to eq 'sRGB'
|
153
153
|
end
|
@@ -161,10 +161,10 @@ RSpec.describe Assembly::Image do
|
|
161
161
|
it 'creates a jp2' do
|
162
162
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
163
163
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
164
|
-
expect(
|
165
|
-
expect(
|
166
|
-
expect(
|
167
|
-
|
164
|
+
expect(assembly_image).not_to have_color_profile
|
165
|
+
expect(assembly_image).to be_a_valid_image
|
166
|
+
expect(assembly_image).to be_jp2able
|
167
|
+
assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
168
168
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
169
169
|
end
|
170
170
|
end
|
@@ -178,7 +178,7 @@ RSpec.describe Assembly::Image do
|
|
178
178
|
it 'does not run' do
|
179
179
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
180
180
|
expect(File).to exist TEST_JP2_OUTPUT_FILE
|
181
|
-
expect {
|
181
|
+
expect { assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE) }.to raise_error(SecurityError)
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
@@ -188,8 +188,8 @@ RSpec.describe Assembly::Image do
|
|
188
188
|
end
|
189
189
|
|
190
190
|
it 'gets the correct image height and width' do
|
191
|
-
expect(
|
192
|
-
expect(
|
191
|
+
expect(assembly_image.height).to eq 100
|
192
|
+
expect(assembly_image.width).to eq 100
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
@@ -201,10 +201,10 @@ RSpec.describe Assembly::Image do
|
|
201
201
|
it 'does not run' do
|
202
202
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
203
203
|
expect(File).not_to exist TEST_JP2_OUTPUT_FILE
|
204
|
-
expect(
|
205
|
-
expect(
|
206
|
-
expect(
|
207
|
-
|
204
|
+
expect(assembly_image).not_to have_color_profile
|
205
|
+
expect(assembly_image).to be_a_valid_image
|
206
|
+
expect(assembly_image).to be_jp2able
|
207
|
+
assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE)
|
208
208
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|
209
209
|
jp2_file = described_class.new(TEST_JP2_OUTPUT_FILE)
|
210
210
|
expect(jp2_file).to be_valid_image
|
@@ -220,7 +220,7 @@ RSpec.describe Assembly::Image do
|
|
220
220
|
|
221
221
|
it 'runs, because this is not currently an option' do
|
222
222
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
223
|
-
result =
|
223
|
+
result = assembly_image.create_jp2(output_profile: 'bogusness')
|
224
224
|
expect(result).to be_a_kind_of described_class
|
225
225
|
expect(result.path).to eq TEST_JP2_INPUT_FILE
|
226
226
|
expect(TEST_JP2_INPUT_FILE).to be_a_jp2
|
@@ -239,7 +239,7 @@ RSpec.describe Assembly::Image do
|
|
239
239
|
bogus_folder = '/crapsticks'
|
240
240
|
expect(File).to exist TEST_JPEG_INPUT_FILE
|
241
241
|
expect(File).not_to exist bogus_folder
|
242
|
-
expect {
|
242
|
+
expect { assembly_image.create_jp2(tmp_folder: bogus_folder) }.to raise_error
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
@@ -251,7 +251,7 @@ RSpec.describe Assembly::Image do
|
|
251
251
|
it 'creates a jp2 of the same filename and in the same location as the input and cleans up the tmp file' do
|
252
252
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
253
253
|
expect(File.exist?(TEST_JP2_INPUT_FILE)).to be false
|
254
|
-
result =
|
254
|
+
result = assembly_image.create_jp2
|
255
255
|
expect(result).to be_a_kind_of described_class
|
256
256
|
expect(result.path).to eq TEST_JP2_INPUT_FILE
|
257
257
|
expect(TEST_JP2_INPUT_FILE).to be_a_jp2
|
@@ -268,7 +268,7 @@ RSpec.describe Assembly::Image do
|
|
268
268
|
it 'recreates jp2' do
|
269
269
|
expect(File).to exist TEST_TIF_INPUT_FILE
|
270
270
|
expect(File).to exist TEST_JP2_OUTPUT_FILE
|
271
|
-
result =
|
271
|
+
result = assembly_image.create_jp2(output: TEST_JP2_OUTPUT_FILE, overwrite: true)
|
272
272
|
expect(result).to be_a_kind_of described_class
|
273
273
|
expect(result.path).to eq TEST_JP2_OUTPUT_FILE
|
274
274
|
expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
|