kelredd-pruview 0.2.4 → 0.3.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.

Potentially problematic release.


This version of kelredd-pruview might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kelredd-pruview (0.2.4)
4
+ kelredd-pruview (0.3.0)
5
5
  flvtool2
6
6
  mini_magick (~> 3.0)
7
7
 
@@ -10,10 +10,10 @@ GEM
10
10
  specs:
11
11
  flvtool2 (1.0.6)
12
12
  leftright (0.9.1)
13
- mini_magick (3.2)
14
- subexec (~> 0.0.4)
13
+ mini_magick (3.4)
14
+ subexec (~> 0.2.1)
15
15
  rake (0.9.2)
16
- subexec (0.0.4)
16
+ subexec (0.2.2)
17
17
  test-belt (2.0.0)
18
18
  leftright (~> 0.9.0)
19
19
 
@@ -71,17 +71,22 @@ module Pruview
71
71
  end
72
72
 
73
73
  def process_image(image)
74
- image.format PROCESS_FORMAT
74
+ image.format PROCESS_FORMAT do |command|
75
+ command.args << GLOBAL_CMD_ARGS
76
+ end
75
77
  set_RGB_colorspace(image)
76
- image.strip
78
+ image.strip do |command|
79
+ command.args << GLOBAL_CMD_ARGS
80
+ end
77
81
  return image
78
82
  end
79
83
 
80
84
  def set_RGB_colorspace(image)
81
- colorspace = run_system_command("identify -format \"%r\" #{image.path}", "Error reading document colorspace")
85
+ colorspace = run_system_command("identify #{GLOBAL_CMD_ARGS} -format \"%r\" #{image.path}", "Error reading document colorspace")
82
86
  puts "Colorspace: #{colorspace}"
83
87
  if colorspace =~ /CMYK/
84
88
  image.combine_options do |img|
89
+ img.args << GLOBAL_CMD_ARGS
85
90
  img.profile File.join(File.dirname(__FILE__), 'USWebCoatedSWOP.icc')
86
91
  img.profile File.join(File.dirname(__FILE__), 'sRGB.icm')
87
92
  img.colorspace 'sRGB'
@@ -93,7 +98,11 @@ module Pruview
93
98
  begin
94
99
  image = MiniMagick::Image.open(@image.path)
95
100
  crop_image(image, crop)
96
- image.resize "#{width}x#{height}" if crop || @image[:width].to_i > width || @image[:height] > height
101
+ if crop || @image[:width].to_i > width || @image[:height] > height
102
+ image.resize "#{width}x#{height}" do |cmd|
103
+ cmd.args << GLOBAL_CMD_ARGS
104
+ end
105
+ end
97
106
  return image
98
107
  rescue Exception => err
99
108
  raise "Error scaling image: #{err.message}"
@@ -112,14 +121,18 @@ module Pruview
112
121
  # shave off height
113
122
  shave_off = ((image[:height].to_i - rheight)/2).round
114
123
  puts "shave off height: #{image[:height].to_i - rheight}"
115
- image.shave("0x#{shave_off}")
124
+ image.shave("0x#{shave_off}") do |cmd|
125
+ cmd.args << GLOBAL_CMD_ARGS
126
+ end
116
127
  puts "image crop size: #{image[:width].to_i}x#{image[:height].to_i}"
117
128
  elsif ratio_height > ratio_width || (ratio_width == ratio_height && image[:width].to_i > image[:height].to_i)
118
129
  # calc ratio width from height
119
130
  rwidth = (image[:height].to_i*(ratio_width.to_f / ratio_height.to_f)).round
120
131
  # shave off width
121
132
  shave_off = ((image[:width].to_i - rwidth).to_f / 2.to_f).round
122
- image.shave("#{shave_off}x0")
133
+ image.shave("#{shave_off}x0") do |cmd|
134
+ cmd.args << GLOBAL_CMD_ARGS
135
+ end
123
136
  end
124
137
  end
125
138
  return image
@@ -135,6 +148,7 @@ module Pruview
135
148
 
136
149
  # Configurations
137
150
  Document::PROCESS_FORMAT = 'jpg'
151
+ Document::GLOBAL_CMD_ARGS = '-limit memory 500mb'
138
152
 
139
153
  Document::PSD_EXT = '.psd'
140
154
  Document::POSTSCRIPT_EXT = ['.pdf', '.eps', '.ai']
@@ -1,3 +1,3 @@
1
1
  module Pruview
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-pruview
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 4
10
- version: 0.2.4
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly D. Redding
@@ -15,9 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-02 00:00:00 Z
18
+ date: 2012-06-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ type: :development
21
22
  requirement: &id001 !ruby/object:Gem::Requirement
22
23
  none: false
23
24
  requirements:
@@ -28,11 +29,11 @@ dependencies:
28
29
  - 1
29
30
  - 0
30
31
  version: "1.0"
32
+ name: bundler
31
33
  version_requirements: *id001
32
34
  prerelease: false
33
- name: bundler
34
- type: :development
35
35
  - !ruby/object:Gem::Dependency
36
+ type: :development
36
37
  requirement: &id002 !ruby/object:Gem::Requirement
37
38
  none: false
38
39
  requirements:
@@ -43,11 +44,11 @@ dependencies:
43
44
  - 2
44
45
  - 0
45
46
  version: "2.0"
47
+ name: test-belt
46
48
  version_requirements: *id002
47
49
  prerelease: false
48
- name: test-belt
49
- type: :development
50
50
  - !ruby/object:Gem::Dependency
51
+ type: :runtime
51
52
  requirement: &id003 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
@@ -58,11 +59,11 @@ dependencies:
58
59
  - 3
59
60
  - 0
60
61
  version: "3.0"
62
+ name: mini_magick
61
63
  version_requirements: *id003
62
64
  prerelease: false
63
- name: mini_magick
64
- type: :runtime
65
65
  - !ruby/object:Gem::Dependency
66
+ type: :runtime
66
67
  requirement: &id004 !ruby/object:Gem::Requirement
67
68
  none: false
68
69
  requirements:
@@ -72,10 +73,9 @@ dependencies:
72
73
  segments:
73
74
  - 0
74
75
  version: "0"
76
+ name: flvtool2
75
77
  version_requirements: *id004
76
78
  prerelease: false
77
- name: flvtool2
78
- type: :runtime
79
79
  description: Ease generating image previews (thumbnails) of various files
80
80
  email:
81
81
  - kelly@kelredd.com
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  requirements: []
141
141
 
142
142
  rubyforge_project:
143
- rubygems_version: 1.7.2
143
+ rubygems_version: 1.8.11
144
144
  signing_key:
145
145
  specification_version: 3
146
146
  summary: Ease generating image previews (thumbnails) of various files