Class: Filtr::Image
- Inherits:
-
Object
- Object
- Filtr::Image
- Defined in:
- lib/filtr/image.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#mask ⇒ Object
readonly
Returns the value of attribute mask.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#vignette_mask ⇒ Object
readonly
Returns the value of attribute vignette_mask.
Class Method Summary collapse
- .blues(file_path) ⇒ Object
- .dazed(file_path) ⇒ Object
- .julee(file_path) ⇒ Object
- .lomo(file_path) ⇒ Object
- .postcard(file_path) ⇒ Object
- .rockstar(file_path) ⇒ Object
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(file_path) ⇒ Image
8 9 10 11 12 13 |
# File 'lib/filtr/image.rb', line 8 def initialize(file_path) @file_path = File.(file_path) @path = @file_path.chomp(File.extname(@file_path))+"-lomo.png" @mask = @file_path.chomp(File.extname(@file_path))+"-mask.png" @vignette_mask = File.join(File.dirname(__FILE__), "assets", "vignette.png") end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
3 4 5 |
# File 'lib/filtr/image.rb', line 3 def file_path @file_path end |
#mask ⇒ Object (readonly)
Returns the value of attribute mask.
5 6 7 |
# File 'lib/filtr/image.rb', line 5 def mask @mask end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/filtr/image.rb', line 4 def path @path end |
#vignette_mask ⇒ Object (readonly)
Returns the value of attribute vignette_mask.
6 7 8 |
# File 'lib/filtr/image.rb', line 6 def vignette_mask @vignette_mask end |
Class Method Details
.blues(file_path) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/filtr/image.rb', line 72 def blues(file_path) image = self.new(file_path) `cp #{image.file_path} #{image.path}` `convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 125,50 -contrast -contrast -contrast #{image.path} #{image.path}` `convert #{image.path} -fill blue -colorize 10% #{image.path}` return image end |
.dazed(file_path) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/filtr/image.rb', line 51 def dazed(file_path) image = self.new(file_path) `cp #{image.file_path} #{image.path}` `convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,150 -contrast -contrast -contrast #{image.path} #{image.path}` `convert -gaussian 1x2 #{image.path} #{image.path}` return image end |
.julee(file_path) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/filtr/image.rb', line 59 def julee(file_path) image = self.new(file_path) `cp #{image.file_path} #{image.path}` `convert -resize 800x600\\> #{image.path} #{image.path}` `convert -gaussian 1x2 +matte #{image.path} #{image.mask}` `convert -gaussian 0x5 -contrast -modulate 100,60 #{image.mask} #{image.mask}` `convert -modulate 100,60 #{image.path} #{image.path}` `convert -contrast #{image.path} #{image.path}` `composite -compose screen #{image.mask} #{image.path} #{image.path}` `convert -modulate 125,200 #{image.path} #{image.path}` return image end |
.lomo(file_path) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/filtr/image.rb', line 17 def lomo(file_path) image = self.new(file_path) dimensions = "800x600" `cp #{image.file_path} #{image.path}` `convert -resize 800x600\\> #{image.path} #{image.path}` dimensions = `identify -format '%wx%h' #{image.path}`.split("\n")[0] `convert -unsharp 1.5x1.5 #{image.path} #{image.path}` `convert -contrast -contrast #{image.path} #{image.path}` `convert -modulate 100,120 #{image.path} #{image.path}` `convert -resize #{dimensions}\\! #{image.vignette_mask} #{image.mask}` `composite -compose multiply #{image.mask} #{image.path} #{image.path}` return image end |
.postcard(file_path) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/filtr/image.rb', line 31 def postcard(file_path) image = self.new(file_path) `cp #{image.file_path} #{image.path}` `convert -size 800x600\\> -contrast -modulate 100,150 -gaussian 1x2 +matte #{image.path} #{image.mask}` `convert -gaussian 0x5 -modulate 180,150 #{image.mask} #{image.mask}` `convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,100 -contrast -contrast -contrast #{image.path} #{image.path}` `convert -gaussian 1x2 #{image.path} #{image.path}` `composite -compose multiply #{image.mask} #{image.path} #{image.path}` return image end |
.rockstar(file_path) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/filtr/image.rb', line 42 def rockstar(file_path) image = self.new(file_path) `cp #{image.file_path} #{image.path}` `convert -resize 800x600\\> -unsharp 1.5x1.5 -modulate 175,150 -contrast -contrast -contrast #{image.path} #{image.path}` `convert -gaussian 1x2 #{image.path} #{image.path}` `convert -depth 16 -colorspace GRAY -contrast -sharpen 5x5 #{image.path} #{image.path}` return image end |