photomontage 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -3
- data/config/interaction.rb +7 -0
- data/lib/flickr.rb +11 -12
- data/lib/photomontage/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76b1c10c350549be48029a1136c806ee1ce89148
|
4
|
+
data.tar.gz: 10d78fdc616f17de6e1dfce0f940a08459c0c271
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86ae4161945f09c9bb083744f2cd7d4d5bc2b99a06038e6da47098a448b737ab00a8f426fa4891d0c9690a9a24df6557a52e12da8821464111feaff4f39015b1
|
7
|
+
data.tar.gz: d8fc9b271994967b8c7faa602152b1ae259acb83db30e0ad09d5845b3cbb97d94625d98bb7c4fe7ad2d79dbfb92cc79f4d2c03363b287d4677af781c6e9b4446
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Photomontage
|
2
2
|
|
3
|
-
|
3
|
+
Photomontage is a ruby gem that accepts search keywords provided by the user, fetches images that are relevant to the words, and collates them into a collage.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,13 +18,41 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install photomontage
|
20
20
|
|
21
|
+
## Installation dependencies
|
22
|
+
|
23
|
+
1. Ensure you have ImageMagick (https://www.imagemagick.org/script/binary-releases.php) installed in your system.
|
24
|
+
|
25
|
+
2. Troubleshooting installation of rmagick gem (https://github.com/rmagick/rmagick/#user-content-wrong)
|
26
|
+
|
21
27
|
## Usage
|
22
28
|
|
23
|
-
|
29
|
+
Open Ruby interactive shell:
|
30
|
+
|
31
|
+
$ irb
|
32
|
+
|
33
|
+
Require photomontage gem:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
> require 'photomontage'
|
37
|
+
```
|
38
|
+
|
39
|
+
Build your collage!
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
> Photomontage.begin
|
43
|
+
```
|
44
|
+
|
45
|
+
To view the collage image, exit from irb:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
> exit
|
49
|
+
```
|
50
|
+
|
51
|
+
$ open images/file_name.jpg
|
24
52
|
|
25
53
|
## Contributing
|
26
54
|
|
27
|
-
1. Fork it ( https://github.com/
|
55
|
+
1. Fork it ( https://github.com/aishwarya923/photomontage/fork )
|
28
56
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
57
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
58
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
module Interaction
|
3
|
+
WELCOME = "Hi there! Welcome to Photomontage!!\nSimply provide 10 or less words, and get a collage of pictures representing your words, in seconds!\n".green + "Type".green + " 'exit' ".red + "anytime to stop providing words \n".green
|
4
|
+
IN_PROGRESS = "\nHold on...While we make your collage...\n".green
|
5
|
+
FILE_NAME = "\n\nGreat! Your photo collage is ready! What would you like to name it? \n".yellow + "* Do not provide file extension.".red
|
6
|
+
COMPLETE = "\n\nDone! Type".green + " 'open images/FILE_NAME.jpg' ".magenta + "to view your image now! \n*If you using ruby interactive shell, exit from the shell.".green
|
7
|
+
end
|
data/lib/flickr.rb
CHANGED
@@ -56,27 +56,26 @@ class Flickr
|
|
56
56
|
result.write "images/#{file_name}.jpg"
|
57
57
|
end
|
58
58
|
|
59
|
-
def self.loop_images(
|
60
|
-
i
|
59
|
+
def self.loop_images(result)
|
60
|
+
@i,@y=0,0
|
61
61
|
(0..1).each do |j|
|
62
|
-
x = -200
|
62
|
+
@x = -200
|
63
63
|
5.times{
|
64
|
-
img = MiniMagick::Image.new("tmp/#{i}.jpg")
|
65
|
-
result = make_composite_image(result, img
|
64
|
+
img = MiniMagick::Image.new("tmp/#{@i}.jpg")
|
65
|
+
result = make_composite_image(result, img)
|
66
66
|
}
|
67
|
-
y += 300
|
67
|
+
@y += 300
|
68
68
|
end
|
69
69
|
result
|
70
70
|
end
|
71
71
|
|
72
|
-
def self.make_composite_image(result, img
|
73
|
-
result.composite(img) do |c|
|
72
|
+
def self.make_composite_image(result, img)
|
73
|
+
result = result.composite(img) do |c|
|
74
74
|
c.compose "Over"
|
75
|
-
x += 200
|
76
|
-
i += 1
|
77
|
-
c.geometry "+#{x}+#{y}"
|
75
|
+
@x += 200
|
76
|
+
@i += 1
|
77
|
+
c.geometry "+#{@x}+#{@y}"
|
78
78
|
end
|
79
|
-
result
|
80
79
|
end
|
81
80
|
|
82
81
|
def set_image_url(response)
|
data/lib/photomontage/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photomontage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aishwarya
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- README.md
|
151
151
|
- Rakefile
|
152
152
|
- bin/photomontage
|
153
|
+
- config/interaction.rb
|
153
154
|
- lib/flickr.rb
|
154
155
|
- lib/photomontage.rb
|
155
156
|
- lib/photomontage/version.rb
|