checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: 0ea288afa9ba1d87bb8c586821464bcde01fabf1994e4916d46599a2efead8f5
4
- data.tar.gz: cb2cad9ca0d9e1398dd0b094af228c988fb8cb8e21c5b6533aee6096162129bf
3
+ metadata.gz: dee27ed2f2ed8bf8a3878bac7a41448a8f7a54fbdd8e1800434ce0af812bf1aa
4
+ data.tar.gz: 8ff1e21029d7b8c4bbc045522a3d2e7fdc06c9940cc09c73287e1bf15e60a11f
5
5
SHA512:
6
- metadata.gz: 1e749a5ff2fe27cf78b5b22d481871e50de538c15ead670b4e99a99de3350675c5b57159952b586f757d9f03bc59b7870fec610a0506fa874e88f188f0ddd8cb
7
- data.tar.gz: 4534e0fdb7e25a10d8a6b53cdced0055399e404e14652215f5a4137fd1fcb6b24be63678911db9b4e4921dc043c36e07a30baa8969bb394dbe9dd06880d5b09a
6
+ metadata.gz: edf348cb16c843850f0a496be66ec2db8e21587970caadf72b31b2ecddeb2387ab69e0c6b308e5c30d02a2e66dd4de67e01f260985ed238a546448b4aacf9667
7
+ data.tar.gz: 27072b70647d8a657885f74ce952210efa0c070c10597ee4c7480029e845b78549c33478a5f503ebabc70e8d9c870e7376620d173e04b27eba31f0342517dca6
data/lib/assembly-image/image.rb CHANGED
@@ -181,6 +181,7 @@ module Assembly
181
181
# rubocop:disable Metrics/MethodLength
182
182
def kdu_compress_default_options
183
183
[
184
+ '-num_threads 2', # forces Kakadu to only use 2 threads
184
185
'-precise', # forces the use of 32-bit representations
185
186
'-no_weights', # minimization of the MSE over all reconstructed colour components
186
187
'-quiet', # suppress informative messages.
@@ -269,6 +270,10 @@ module Assembly
269
270
tmp_path = tmp_tiff_file.path
270
271
271
272
options = []
273
+
274
+ # Limit the amount of memory ImageMagick is able to use.
275
+ options << '-limit memory 1GiB -limit map 1GiB'
276
+
272
277
case samples_per_pixel
273
278
when 3
274
279
options << '-type TrueColor'
data/lib/assembly-image/version.rb CHANGED
@@ -5,6 +5,6 @@ module Assembly
5
5
# Main Image class
6
6
class Image
7
7
# Project version number
8
- VERSION = '1.7.4'
8
+ VERSION = '1.7.5'
9
9
end
10
10
end
data/spec/image_spec.rb CHANGED
@@ -75,7 +75,7 @@ describe Assembly::Image do
75
75
# of supplied image components and/or colour palette. You can address this
76
76
# problem by supplying a `-jp2_space' or `-jpx_space' argument to explicitly
77
77
# identify a colour space that has anywhere from 1 to 1 colour components.
78
- generate_test_image(TEST_TIF_INPUT_FILE, color: 'white', image_type: 'Bilevel')
78
+ generate_test_image(TEST_TIF_INPUT_FILE, image_type: 'Bilevel')
79
79
expect(File).to exist TEST_TIF_INPUT_FILE
80
80
expect(File).to_not exist TEST_JP2_OUTPUT_FILE
81
81
@ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
@@ -88,7 +88,7 @@ describe Assembly::Image do
88
88
end
89
89
90
90
it 'creates color jp2 when given a color tif but bitonal image data (1 channels and 1 bits per pixel)' do
91
- generate_test_image(TEST_TIF_INPUT_FILE, color: 'white', image_type: 'TrueColor', profile: '')
91
+ generate_test_image(TEST_TIF_INPUT_FILE, color: 'Bilevel', image_type: 'TrueColor', profile: '')
92
92
expect(File).to exist TEST_TIF_INPUT_FILE
93
93
expect(File).to_not exist TEST_JP2_OUTPUT_FILE
94
94
@ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
@@ -101,7 +101,7 @@ describe Assembly::Image do
101
101
end
102
102
103
103
it 'creates grayscale jp2 when given a graycale tif but with bitonal image data (1 channel and 1 bits per pixel)' do
104
- generate_test_image(TEST_TIF_INPUT_FILE, color: 'white', image_type: 'Grayscale', profile: '')
104
+ generate_test_image(TEST_TIF_INPUT_FILE, color: 'Bilevel', image_type: 'Grayscale', profile: '')
105
105
expect(File).to exist TEST_TIF_INPUT_FILE
106
106
expect(File).to_not exist TEST_JP2_OUTPUT_FILE
107
107
@ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
@@ -114,7 +114,7 @@ describe Assembly::Image do
114
114
end
115
115
116
116
it 'creates color jp2 when given a color tif but with greyscale image data (1 channel and 8 bits per pixel)' do
117
- generate_test_image(TEST_TIF_INPUT_FILE, color: 'gray', image_type: 'TrueColor', profile: '')
117
+ generate_test_image(TEST_TIF_INPUT_FILE, color: 'Grayscale', image_type: 'TrueColor', profile: '')
118
118
expect(File).to exist TEST_TIF_INPUT_FILE
119
119
expect(File).to_not exist TEST_JP2_OUTPUT_FILE
120
120
@ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
@@ -157,8 +157,17 @@ describe Assembly::Image do
157
157
end
158
158
159
159
it 'does not run if the input file is a jp2' do
160
- generate_test_image(TEST_JP2_OUTPUT_FILE)
161
- expect(File).to exist TEST_JP2_OUTPUT_FILE
160
+ generate_test_image(TEST_TIF_INPUT_FILE, profile: '') # generate a test input with no profile
161
+ expect(File).to exist TEST_TIF_INPUT_FILE
162
+ expect(File).to_not exist TEST_JP2_OUTPUT_FILE
163
+ @ai = Assembly::Image.new(TEST_TIF_INPUT_FILE)
164
+ # Indicates a temp tiff was not created.
165
+ expect(@ai.tmp_path).to be_nil
166
+ expect(@ai).to_not have_color_profile
167
+ expect(@ai).to be_a_valid_image
168
+ expect(@ai).to be_jp2able
169
+ @ai.create_jp2(output: TEST_JP2_OUTPUT_FILE)
170
+ expect(TEST_JP2_OUTPUT_FILE).to be_a_jp2
162
171
@ai = Assembly::Image.new(TEST_JP2_OUTPUT_FILE)
163
172
expect(@ai).to be_valid_image
164
173
expect(@ai).to_not be_jp2able
data/spec/spec_helper.rb CHANGED
@@ -17,10 +17,10 @@ TEST_DRUID = 'nx288wh8889'
17
17
# rubocop:disable Metrics/CyclomaticComplexity
18
18
# rubocop:disable Metrics/MethodLength
19
19
def generate_test_image(file, params = {})
20
- color = params[:color] || 'red'
20
+ color = params[:color] || 'TrueColor'
21
21
profile = params[:profile] || 'sRGBIEC6196621'
22
22
image_type = params[:image_type]
23
- create_command = "convert -size 100x100 xc:#{color} "
23
+ create_command = "convert rose: -scale 100x100\! -type #{color} "
24
24
create_command += ' -profile ' + File.join(Assembly::PATH_TO_IMAGE_GEM, 'profiles', profile + '.icc') + ' ' unless profile == ''
25
25
create_command += " -type #{image_type} " if image_type
26
26
create_command += ' -compress lzw ' if params[:compress]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: assembly-image
3
3
version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.5
5
5
platform: ruby
6
6
authors:
7
7
- Peter Mangiafico
@@ -11,7 +11,7 @@ authors:
11
11
autorequire:
12
12
bindir: exe
13
13
cert_chain: []
14
- date: 2019-04-08 00:00:00.000000000 Z
14
+ date: 2019-07-26 00:00:00.000000000 Z
15
15
dependencies:
16
16
- !ruby/object:Gem::Dependency
17
17
name: assembly-objectfile
@@ -154,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
- !ruby/object:Gem::Version
155
155
version: '0'
156
156
requirements: []
157
- rubyforge_project: assembly-image
157
+ rubygems_version: 3.0.3
158
- rubygems_version: 2.7.8
159
158
signing_key:
160
159
specification_version: 4
161
160
summary: Ruby immplementation of image services needed to prepare objects to be accessioned