pxlsrt 1.0.1 → 1.1.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/bin/pxlsrt +4 -4
- data/lib/pxlsrt/brute.rb +8 -6
- data/lib/pxlsrt/smart.rb +8 -6
- data/lib/pxlsrt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c455c010ab329820430a363b27dfe45cd0ce4e14
|
4
|
+
data.tar.gz: 1faf61c9dc33f67e4d965d2fbc31f55d23c532f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd8d683a11850820c70494ec5f97afbaf29fb9e50933f7d6e31f85738684541bcaea30060b73655af53a4fa11c50ca241564214c3841f4b97e40bedd5736b3e5
|
7
|
+
data.tar.gz: ba6e7386d8e1287a538f4e7ab334ac05f3e4e002d4702f3c84faa93938b497d8b8f4f83826cd8b0178b180cc1b1cbe8e6aeb6e1bf43ca17141c1df589927192e
|
data/bin/pxlsrt
CHANGED
@@ -29,11 +29,11 @@ class CLI < Thor
|
|
29
29
|
# * min - Minimum bandwidth.
|
30
30
|
# * max - Maximum bandwidth.
|
31
31
|
def brute(input, output)
|
32
|
-
k={}
|
32
|
+
k={:trusted=>true}
|
33
33
|
for o in options.keys
|
34
34
|
k[o.to_sym]=options[o]
|
35
35
|
end
|
36
|
-
Pxlsrt::Brute.suite(input, output,
|
36
|
+
Pxlsrt::Brute.suite(input, output, k)
|
37
37
|
end
|
38
38
|
|
39
39
|
option :absolute, :type => :boolean, :default => false, :aliases => "-a", :banner => "ABSOLUTE EDGE FINDING"
|
@@ -46,11 +46,11 @@ class CLI < Thor
|
|
46
46
|
# * absolute - Make edge finding absolute over relative. For example, define a range as a collection of values under the threshold. Relative edge finding is when the contrast of the next pixel is larger than the threshold.
|
47
47
|
# * edge - Buffers edge.
|
48
48
|
def smart(input, output)
|
49
|
-
k={}
|
49
|
+
k={:trusted=>true}
|
50
50
|
for o in options.keys
|
51
51
|
k[o.to_sym]=options[o]
|
52
52
|
end
|
53
|
-
Pxlsrt::Smart.suite(input, output,
|
53
|
+
Pxlsrt::Smart.suite(input, output, k)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
data/lib/pxlsrt/brute.rb
CHANGED
@@ -8,15 +8,15 @@ module Pxlsrt
|
|
8
8
|
class Brute
|
9
9
|
##
|
10
10
|
# Uses Pxlsrt::Brute.brute to input and output from one method.
|
11
|
-
def self.suite(inputFileName, outputFileName,
|
12
|
-
kml=Pxlsrt::Brute.brute(inputFileName,
|
11
|
+
def self.suite(inputFileName, outputFileName, o={})
|
12
|
+
kml=Pxlsrt::Brute.brute(inputFileName, o)
|
13
13
|
if Pxlsrt::Helpers.contented(kml)
|
14
14
|
kml.save(outputFileName)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
##
|
18
18
|
# The main attraction of the Brute class. Returns a ChunkyPNG::Image that is sorted according to the options provided. Will return nil if it encounters an errors.
|
19
|
-
def self.brute(input,
|
19
|
+
def self.brute(input, o={})
|
20
20
|
startTime=Time.now
|
21
21
|
defOptions={
|
22
22
|
:reverse => "no",
|
@@ -26,7 +26,8 @@ module Pxlsrt
|
|
26
26
|
:method => "sum-rgb",
|
27
27
|
:verbose => false,
|
28
28
|
:min => Float::INFINITY,
|
29
|
-
:max => Float::INFINITY
|
29
|
+
:max => Float::INFINITY,
|
30
|
+
:trusted => false
|
30
31
|
}
|
31
32
|
defRules={
|
32
33
|
:reverse => ["no", "reverse", "either"],
|
@@ -36,10 +37,11 @@ module Pxlsrt
|
|
36
37
|
:method => ["sum-rgb", "red", "green", "blue", "sum-hsb", "hue", "saturation", "brightness", "uniqueness", "luma", "random"],
|
37
38
|
:verbose => [false, true],
|
38
39
|
:min => [Float::INFINITY, {:class => [Fixnum]}],
|
39
|
-
:max => [Float::INFINITY, {:class => [Fixnum]}]
|
40
|
+
:max => [Float::INFINITY, {:class => [Fixnum]}],
|
41
|
+
:trusted => [false, true]
|
40
42
|
}
|
41
43
|
options=defOptions.merge(o)
|
42
|
-
if o.length==0 or trusted==true or (trusted==false and o.length!=0 and Pxlsrt::Helpers.checkOptions(options, defRules)!=false)
|
44
|
+
if o.length==0 or o[:trusted]==true or (o[:trusted]==false and o.length!=0 and Pxlsrt::Helpers.checkOptions(options, defRules)!=false)
|
43
45
|
Pxlsrt::Helpers.verbose("Options are all good.") if options[:verbose]
|
44
46
|
if input.class==String
|
45
47
|
Pxlsrt::Helpers.verbose("Getting image from file...") if options[:verbose]
|
data/lib/pxlsrt/smart.rb
CHANGED
@@ -9,15 +9,15 @@ module Pxlsrt
|
|
9
9
|
class Smart
|
10
10
|
##
|
11
11
|
# Uses Pxlsrt::Smart.smart to input and output from pne method.
|
12
|
-
def self.suite(inputFileName, outputFileName,
|
13
|
-
kml=Pxlsrt::Smart.smart(inputFileName,
|
12
|
+
def self.suite(inputFileName, outputFileName, o={})
|
13
|
+
kml=Pxlsrt::Smart.smart(inputFileName, o)
|
14
14
|
if Pxlsrt::Helpers.contented(kml)
|
15
15
|
kml.save(outputFileName)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
##
|
19
19
|
# The main attraction of the Smart class. Returns a ChunkyPNG::Image that is sorted according to the options provided. Will return nil if it encounters an errors.
|
20
|
-
def self.smart(input,
|
20
|
+
def self.smart(input, o={})
|
21
21
|
startTime=Time.now
|
22
22
|
defOptions={
|
23
23
|
:reverse => "no",
|
@@ -28,7 +28,8 @@ module Pxlsrt
|
|
28
28
|
:verbose => false,
|
29
29
|
:absolute => false,
|
30
30
|
:threshold => 20,
|
31
|
-
:edge => 2
|
31
|
+
:edge => 2,
|
32
|
+
:trusted => false
|
32
33
|
}
|
33
34
|
defRules={
|
34
35
|
:reverse => ["no", "reverse", "either"],
|
@@ -39,10 +40,11 @@ module Pxlsrt
|
|
39
40
|
:verbose => [false, true],
|
40
41
|
:absolute => [false, true],
|
41
42
|
:threshold => [{:class => [Float, Fixnum]}],
|
42
|
-
:edge => [{:class => [Fixnum]}]
|
43
|
+
:edge => [{:class => [Fixnum]}],
|
44
|
+
:trusted => [false, true]
|
43
45
|
}
|
44
46
|
options=defOptions.merge(o)
|
45
|
-
if o.length==0 or trusted==true or (trusted==false and o.length!=0 and Pxlsrt::Helpers.checkOptions(options, defRules)!=false)
|
47
|
+
if o.length==0 or o[:trusted]==true or (o[:trusted]==false and o.length!=0 and Pxlsrt::Helpers.checkOptions(options, defRules)!=false)
|
46
48
|
Pxlsrt::Helpers.verbose("Options are all good.") if options[:verbose]
|
47
49
|
if input.class==String
|
48
50
|
Pxlsrt::Helpers.verbose("Getting image from file...") if options[:verbose]
|
data/lib/pxlsrt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pxlsrt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- EVA-01
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|