filtr 0.0.1 → 0.0.2
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.
- data/lib/filtr/assets/texture.jpg +0 -0
- data/lib/filtr/assets/vignette.png +0 -0
- data/lib/filtr/image.rb +74 -0
- data/lib/filtr/version.rb +1 -1
- data/lib/filtr.rb +1 -74
- metadata +6 -3
|
Binary file
|
|
Binary file
|
data/lib/filtr/image.rb
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module Filtr
|
|
2
|
+
class Image
|
|
3
|
+
attr :file_path
|
|
4
|
+
attr :path
|
|
5
|
+
attr :mask
|
|
6
|
+
attr :vignette_mask
|
|
7
|
+
|
|
8
|
+
def initialize(file_path)
|
|
9
|
+
@file_path = File.expand_path(file_path)
|
|
10
|
+
@path = @file_path.chomp(File.extname(@file_path))+"-lomo.png"
|
|
11
|
+
@mask = @file_path.chomp(File.extname(@file_path))+"-mask.png"
|
|
12
|
+
@vignette_mask = File.join(File.dirname(__FILE__), "assets", "vignette.png")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class << self
|
|
16
|
+
|
|
17
|
+
def lomo(file_path)
|
|
18
|
+
image = self.new(file_path)
|
|
19
|
+
dimensions = "800x600"
|
|
20
|
+
`cp #{image.file_path} #{image.path}`
|
|
21
|
+
`convert -resize 800x600\\> #{image.path} #{image.path}`
|
|
22
|
+
dimensions = `identify -format '%wx%h' #{image.path}`.split("\n")[0]
|
|
23
|
+
`convert -unsharp 1.5x1.5 #{image.path} #{image.path}`
|
|
24
|
+
`convert -contrast -contrast #{image.path} #{image.path}`
|
|
25
|
+
`convert -modulate 100,120 #{image.path} #{image.path}`
|
|
26
|
+
`convert -resize #{dimensions}\\! #{image.vignette_mask} #{image.mask}`
|
|
27
|
+
`composite -compose multiply #{image.mask} #{image.path} #{image.path}`
|
|
28
|
+
return image
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def postcard(file_path)
|
|
32
|
+
image = self.new(file_path)
|
|
33
|
+
`cp #{image.file_path} #{image.path}`
|
|
34
|
+
`convert -size 800x600\\> -contrast -modulate 100,150 -gaussian 1x2 +matte #{image.path} #{image.mask}`
|
|
35
|
+
`convert -gaussian 0x5 -modulate 180,150 #{image.mask} #{image.mask}`
|
|
36
|
+
`convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,100 -contrast -contrast -contrast #{image.path} #{image.path}`
|
|
37
|
+
`convert -gaussian 1x2 #{image.path} #{image.path}`
|
|
38
|
+
`composite -compose multiply #{image.mask} #{image.path} #{image.path}`
|
|
39
|
+
return image
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def rockstar(file_path)
|
|
43
|
+
image = self.new(file_path)
|
|
44
|
+
`cp #{image.file_path} #{image.path}`
|
|
45
|
+
`convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,150 -contrast -contrast -contrast #{image.path} #{image.path}`
|
|
46
|
+
`convert -gaussian 1x2 #{image.path} #{image.path}`
|
|
47
|
+
`convert -depth 16 -colorspace GRAY -contrast -sharpen 5x5 #{image.path} #{image.path}`
|
|
48
|
+
return image
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def dazed(file_path)
|
|
52
|
+
image = self.new(file_path)
|
|
53
|
+
`cp #{image.file_path} #{image.path}`
|
|
54
|
+
`convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,150 -contrast -contrast -contrast #{image.path} #{image.path}`
|
|
55
|
+
`convert -gaussian 1x2 #{image.path} #{image.path}`
|
|
56
|
+
return image
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def julee(file_path)
|
|
60
|
+
image = self.new(file_path)
|
|
61
|
+
`cp #{image.file_path} #{image.path}`
|
|
62
|
+
`convert -resize 800x600\\> #{image.path} #{image.path}`
|
|
63
|
+
`convert -gaussian 1x2 +matte #{image.path} #{image.mask}`
|
|
64
|
+
`convert -gaussian 0x5 -contrast -modulate 100,60 #{image.mask} #{image.mask}`
|
|
65
|
+
`convert -modulate 100,60 #{image.path} #{image.path}`
|
|
66
|
+
`convert -contrast #{image.path} #{image.path}`
|
|
67
|
+
`composite -compose screen #{image.mask} #{image.path} #{image.path}`
|
|
68
|
+
`convert -modulate 125,200 #{image.path} #{image.path}`
|
|
69
|
+
return image
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/filtr/version.rb
CHANGED
data/lib/filtr.rb
CHANGED
|
@@ -1,74 +1 @@
|
|
|
1
|
-
|
|
2
|
-
class Image
|
|
3
|
-
attr :file_path
|
|
4
|
-
attr :path
|
|
5
|
-
attr :mask
|
|
6
|
-
attr :vignette_mask
|
|
7
|
-
|
|
8
|
-
def initialize(file_path)
|
|
9
|
-
@file_path = File.expand_path(file_path)
|
|
10
|
-
@path = @file_path.chomp(File.extname(@file_path))+"-lomo.png"
|
|
11
|
-
@mask = @file_path.chomp(File.extname(@file_path))+"-mask.png"
|
|
12
|
-
@vignette_mask = File.join(File.dirname(__FILE__), "vignette.png")
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
class << self
|
|
16
|
-
|
|
17
|
-
def lomo(file_path)
|
|
18
|
-
image = self.new(file_path)
|
|
19
|
-
dimensions = "800x600"
|
|
20
|
-
`cp #{image.file_path} #{image.path}`
|
|
21
|
-
`convert -resize 800x600\\> #{image.path} #{image.path}`
|
|
22
|
-
dimensions = `identify -format '%wx%h' #{image.path}`.split("\n")[0]
|
|
23
|
-
`convert -unsharp 1.5x1.5 #{image.path} #{image.path}`
|
|
24
|
-
`convert -contrast -contrast #{image.path} #{image.path}`
|
|
25
|
-
`convert -modulate 100,120 #{image.path} #{image.path}`
|
|
26
|
-
`convert -resize #{dimensions}\\! #{image.vignette_mask} #{image.mask}`
|
|
27
|
-
`composite -compose multiply #{image.mask} #{image.path} #{image.path}`
|
|
28
|
-
return image
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def postcard(file_path)
|
|
32
|
-
image = self.new(file_path)
|
|
33
|
-
`cp #{image.file_path} #{image.path}`
|
|
34
|
-
`convert -size 800x600\\> -contrast -modulate 100,150 -gaussian 1x2 +matte #{image.path} #{image.mask}`
|
|
35
|
-
`convert -gaussian 0x5 -modulate 180,150 #{image.mask} #{image.mask}`
|
|
36
|
-
`convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,100 -contrast -contrast -contrast #{image.path} #{image.path}`
|
|
37
|
-
`convert -gaussian 1x2 #{image.path} #{image.path}`
|
|
38
|
-
`composite -compose multiply #{image.mask} #{image.path} #{image.path}`
|
|
39
|
-
return image
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def rockstar(file_path)
|
|
43
|
-
image = self.new(file_path)
|
|
44
|
-
`cp #{image.file_path} #{image.path}`
|
|
45
|
-
`convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,150 -contrast -contrast -contrast #{image.path} #{image.path}`
|
|
46
|
-
`convert -gaussian 1x2 #{image.path} #{image.path}`
|
|
47
|
-
`convert -depth 16 -colorspace GRAY -contrast -sharpen 5x5 #{image.path} #{image.path}`
|
|
48
|
-
return image
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def dazed(file_path)
|
|
52
|
-
image = self.new(file_path)
|
|
53
|
-
`cp #{image.file_path} #{image.path}`
|
|
54
|
-
`convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,150 -contrast -contrast -contrast #{image.path} #{image.path}`
|
|
55
|
-
`convert -gaussian 1x2 #{image.path} #{image.path}`
|
|
56
|
-
return image
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def julee(file_path)
|
|
60
|
-
image = self.new(file_path)
|
|
61
|
-
`cp #{image.file_path} #{image.path}`
|
|
62
|
-
`convert -resize 800x600\\> #{image.path} #{image.path}`
|
|
63
|
-
`convert -gaussian 1x2 +matte #{image.path} #{image.mask}`
|
|
64
|
-
`convert -gaussian 0x5 -contrast -modulate 100,60 #{image.mask} #{image.mask}`
|
|
65
|
-
`convert -modulate 100,60 #{image.path} #{image.path}`
|
|
66
|
-
`convert -contrast #{image.path} #{image.path}`
|
|
67
|
-
`composite -compose screen #{image.mask} #{image.path} #{image.path}`
|
|
68
|
-
`convert -modulate 125,200 #{image.path} #{image.path}`
|
|
69
|
-
return image
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
1
|
+
require 'filtr/image'
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
version: 0.0.
|
|
8
|
+
- 2
|
|
9
|
+
version: 0.0.2
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Burin Asavesna
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2010-11-
|
|
17
|
+
date: 2010-11-17 00:00:00 -06:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies: []
|
|
20
20
|
|
|
@@ -33,6 +33,9 @@ files:
|
|
|
33
33
|
- Rakefile
|
|
34
34
|
- filtr.gemspec
|
|
35
35
|
- lib/filtr.rb
|
|
36
|
+
- lib/filtr/assets/texture.jpg
|
|
37
|
+
- lib/filtr/assets/vignette.png
|
|
38
|
+
- lib/filtr/image.rb
|
|
36
39
|
- lib/filtr/version.rb
|
|
37
40
|
has_rdoc: true
|
|
38
41
|
homepage: http://rubygems.org/gems/filtr
|