filtr 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in filtr.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/filtr.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "filtr/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "filtr"
7
+ s.version = Filtr::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Burin Asavesna"]
10
+ s.email = ["burinasavesna@gmail.com"]
11
+ s.homepage = "http://rubygems.org/gems/filtr"
12
+ s.summary = %q{Wrapper for ImageMagick to provide vintage filter effects on photos.}
13
+ s.description = %q{Wrapper for ImageMagick to provide vintage filter effects on photos.}
14
+
15
+ s.rubyforge_project = "filtr"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
data/lib/filtr.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__), "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
@@ -0,0 +1,3 @@
1
+ module Filtr
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: filtr
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Burin Asavesna
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-14 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Wrapper for ImageMagick to provide vintage filter effects on photos.
22
+ email:
23
+ - burinasavesna@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - Rakefile
34
+ - filtr.gemspec
35
+ - lib/filtr.rb
36
+ - lib/filtr/version.rb
37
+ has_rdoc: true
38
+ homepage: http://rubygems.org/gems/filtr
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirements: []
63
+
64
+ rubyforge_project: filtr
65
+ rubygems_version: 1.3.7
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Wrapper for ImageMagick to provide vintage filter effects on photos.
69
+ test_files: []
70
+