gifme 0.0.3 → 0.0.4
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/README.md +6 -0
- data/Rakefile +1 -1
- data/bin/gifme +22 -1
- data/gifme.gemspec +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -42,6 +42,12 @@ them to the animation so it looks like one smooth motion and back again.
|
|
42
42
|
|
43
43
|
gifme FILES --reverse
|
44
44
|
|
45
|
+
If you pass in a URL of a gif instead of FILES, we'll download that gif, split
|
46
|
+
it into its constituent frames, and let you recreate it. For example, you could
|
47
|
+
take a gif you find online and give it that `--reverse` look:
|
48
|
+
|
49
|
+
gifme http://tumblr.com/some-crazy.gif --reverse
|
50
|
+
|
45
51
|
For other options, check out the help:
|
46
52
|
|
47
53
|
gifme -h
|
data/Rakefile
CHANGED
data/bin/gifme
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'optparse'
|
4
|
+
require 'open-uri'
|
4
5
|
|
5
6
|
def escape(str)
|
6
7
|
String(str).gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').
|
@@ -49,7 +50,7 @@ parser = OptionParser.new do |opts|
|
|
49
50
|
end
|
50
51
|
|
51
52
|
parser.parse!
|
52
|
-
files = *ARGV
|
53
|
+
files = *ARGV
|
53
54
|
|
54
55
|
unless system("which convert 2>&1 > /dev/null")
|
55
56
|
puts "You need to install ImageMagick first.\n\n"
|
@@ -63,6 +64,26 @@ unless files
|
|
63
64
|
exit(1)
|
64
65
|
end
|
65
66
|
|
67
|
+
# WORKING WITH REMOTE FILES
|
68
|
+
if files.first[0..3] == 'http'
|
69
|
+
path = "/tmp/downloaded-gifme.gif"
|
70
|
+
open(path, 'wb') do |file|
|
71
|
+
file << open(files.first).read
|
72
|
+
end
|
73
|
+
|
74
|
+
FileUtils.rm_rf "/tmp/gifme"
|
75
|
+
FileUtils.mkdir "/tmp/gifme"
|
76
|
+
system "cd /tmp/gifme && convert #{path} -coalesce frame_%d.gif"
|
77
|
+
|
78
|
+
files = Dir.entries("/tmp/gifme")
|
79
|
+
files.delete(".")
|
80
|
+
files.delete("..")
|
81
|
+
files = files.collect{|f| "/tmp/gifme/#{f}"}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Escape spaces and all that jazz
|
85
|
+
files = files.collect{|a| escape a}
|
86
|
+
|
66
87
|
cmd = "convert"
|
67
88
|
cmd += " -delay #{options[:delay]}"
|
68
89
|
cmd += " -loop 0"
|
data/gifme.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'gifme'
|
16
|
-
s.version = '0.0.
|
16
|
+
s.version = '0.0.4'
|
17
17
|
s.date = '2011-05-23'
|
18
18
|
s.rubyforge_project = 'gifme'
|
19
19
|
|
metadata
CHANGED