photo-utils 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/photo_utils/apex.rb +3 -3
- data/lib/photo_utils/brightness.rb +1 -1
- data/lib/photo_utils/compensation.rb +24 -5
- data/lib/photo_utils/tool.rb +9 -2
- data/lib/photo_utils/tools/blur.rb +1 -1
- data/lib/photo_utils/tools/brightness.rb +1 -1
- data/lib/photo_utils/tools/calc_aperture.rb +1 -1
- data/lib/photo_utils/tools/cameras.rb +1 -1
- data/lib/photo_utils/tools/chart_dof.rb +3 -4
- data/lib/photo_utils/tools/compare.rb +1 -1
- data/lib/photo_utils/tools/dof.rb +1 -1
- data/lib/photo_utils/tools/dof_table.rb +2 -2
- data/lib/photo_utils/tools/film_test.rb +1 -1
- data/lib/photo_utils/tools/focal_length.rb +3 -3
- data/lib/photo_utils/tools/reciprocity.rb +3 -3
- data/lib/photo_utils/tools/test.rb +1 -1
- data/lib/photo_utils/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8258f2f73bf0c39dd9caad5983abe6692f27f602
|
4
|
+
data.tar.gz: cbf48be31fc7cf3c076d633ceda9cd27e09c69a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b6671c81225c4140fc36947e8fa56ab85e4167e5e1b20a1ada4c09cb2c9f7cea00664dd72645098fc0a5005a06be66900372199bcd9d696c637fad0fe6bef5d
|
7
|
+
data.tar.gz: 36cd6bb50505fee27d5405df3c7243d20c6235b15a5bc2370108182eea7c30bb78eea93f9d1d00d19d56c23e02d0f0476ad58ee7a3cf1c569a8ec72d50f7b8b3
|
data/lib/photo_utils/apex.rb
CHANGED
@@ -76,7 +76,7 @@ module PhotoUtils
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def compensation=(n)
|
79
|
-
@compensation =
|
79
|
+
@compensation = Compensation.new(n)
|
80
80
|
end
|
81
81
|
|
82
82
|
def aperture
|
@@ -164,7 +164,7 @@ module PhotoUtils
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def cv
|
167
|
-
@compensation ? @compensation.
|
167
|
+
@compensation ? @compensation.to_v : 0
|
168
168
|
end
|
169
169
|
|
170
170
|
def ev
|
@@ -179,7 +179,7 @@ module PhotoUtils
|
|
179
179
|
n = increment * (steps / 2)
|
180
180
|
(-n..n).step(increment).map do |adjustment|
|
181
181
|
new_exposure = dup
|
182
|
-
new_exposure.compensation = (@compensation ? @compensation : 0) + adjustment
|
182
|
+
new_exposure.compensation = PhotoUtils::Compensation.new_from_v((@compensation ? @compensation.to_v : 0) + adjustment)
|
183
183
|
new_exposure
|
184
184
|
end
|
185
185
|
end
|
@@ -2,21 +2,40 @@ module PhotoUtils
|
|
2
2
|
|
3
3
|
class Compensation < Value
|
4
4
|
|
5
|
-
# amount specified in
|
5
|
+
# amount specified in factor
|
6
|
+
|
7
|
+
def self.new_from_factor(f)
|
8
|
+
new(f)
|
9
|
+
end
|
6
10
|
|
7
11
|
def self.new_from_v(v)
|
8
|
-
new(v)
|
12
|
+
new(2 ** v)
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_factor
|
16
|
+
to_f
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_v
|
20
|
+
Math.log2(to_f)
|
21
|
+
end
|
22
|
+
|
23
|
+
def format_factor
|
24
|
+
"x%.1f" % to_f.format(10)
|
9
25
|
end
|
10
26
|
|
11
27
|
def format_value
|
28
|
+
v = to_v
|
12
29
|
"Cv:%s%s" % [
|
13
|
-
(
|
14
|
-
abs.format(10)
|
30
|
+
(v < 0) ? '-' : '+',
|
31
|
+
v.abs.format(10)
|
15
32
|
]
|
16
33
|
end
|
17
34
|
|
18
|
-
def to_s(format=:
|
35
|
+
def to_s(format=:factor)
|
19
36
|
case format
|
37
|
+
when :factor
|
38
|
+
format_factor
|
20
39
|
when :value
|
21
40
|
format_value
|
22
41
|
else
|
data/lib/photo_utils/tool.rb
CHANGED
@@ -2,14 +2,21 @@ module PhotoUtils
|
|
2
2
|
|
3
3
|
class Tool
|
4
4
|
|
5
|
+
def initialize
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
self.class.to_s.downcase
|
10
|
+
end
|
11
|
+
|
5
12
|
def usage
|
13
|
+
warn "#{$0} #{name} ..."
|
6
14
|
end
|
7
15
|
|
8
16
|
def description
|
9
17
|
end
|
10
18
|
|
11
|
-
def run
|
12
|
-
raise NotImplementedError, "Tool #{self.class} does not implement \#run"
|
19
|
+
def run
|
13
20
|
end
|
14
21
|
|
15
22
|
end
|
@@ -6,7 +6,7 @@ module PhotoUtils
|
|
6
6
|
|
7
7
|
class ChartDOF < Tool
|
8
8
|
|
9
|
-
def run
|
9
|
+
def run
|
10
10
|
|
11
11
|
# set up basic scene
|
12
12
|
|
@@ -134,9 +134,8 @@ module PhotoUtils
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
|
138
|
-
|
139
|
-
|
137
|
+
output_file = @args.first or raise
|
138
|
+
Path.new(output_file).write(html.target!)
|
140
139
|
end
|
141
140
|
|
142
141
|
end
|
@@ -6,7 +6,7 @@ module PhotoUtils
|
|
6
6
|
|
7
7
|
class DOFTable < Tool
|
8
8
|
|
9
|
-
def run
|
9
|
+
def run
|
10
10
|
scene = Scene.new
|
11
11
|
scene.camera = Camera[/Eastman/]
|
12
12
|
|
@@ -14,7 +14,7 @@ module PhotoUtils
|
|
14
14
|
scene.print_camera
|
15
15
|
puts
|
16
16
|
|
17
|
-
# Av equivalents of f/4
|
17
|
+
# Av equivalents of f/4 ~ f/64
|
18
18
|
apertures = (4..12).map { |av| Aperture.new_from_v(av) }
|
19
19
|
|
20
20
|
first = true
|
@@ -6,11 +6,11 @@ module PhotoUtils
|
|
6
6
|
|
7
7
|
class FocalLength < Tool
|
8
8
|
|
9
|
-
def run
|
10
|
-
from_focal_length, from_format = args.shift.split(':')
|
9
|
+
def run
|
10
|
+
from_focal_length, from_format = @args.shift.split(':')
|
11
11
|
from_focal_length = from_focal_length.to_i
|
12
12
|
from_format = (Format[from_format || '35'] or raise "Unknown format: #{from_format.inspect}")
|
13
|
-
to_formats = args.first ? args.shift.split(',') : %w{1/1.7 APS-C APS-H 35 6x4.5 6x6 6x7 5x7}
|
13
|
+
to_formats = @args.first ? @args.shift.split(',') : %w{1/1.7 APS-C APS-H 35 6x4.5 6x6 6x7 5x7}
|
14
14
|
to_formats.map { |f| Format[f] or raise "Unknown format: #{f.inspect}" }.each do |to_format|
|
15
15
|
scene = Scene.new
|
16
16
|
scene.format = from_format
|
data/lib/photo_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photo-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Labovitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashstruct
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.5.
|
173
|
+
rubygems_version: 2.5.1
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Models, formulas, and utilties for photography optics, etc.
|
@@ -182,4 +182,3 @@ test_files:
|
|
182
182
|
- test/scene_test.rb
|
183
183
|
- test/sensitivity_test.rb
|
184
184
|
- test/time_test.rb
|
185
|
-
has_rdoc:
|