Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 88f0328

Browse files
committedMay 27, 2009
gobbled up a bunch of remvees patches
1 parent 56a4761 commit 88f0328

32 files changed

+399
-2194
lines changed
 

‎History.txt

-4
This file was deleted.

‎License.txt ‎MIT-LICENSE

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2008 FIXME full name
1+
Copyright (c) 2005 Corey Johnson probablycorey@gmail.com
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the
@@ -17,4 +17,5 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1717
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1818
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1919
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+

‎Manifest.txt

-16
This file was deleted.

‎README.rdoc

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
= MiniMagick
2+
3+
A ruby wrapper for ImageMagick command line.
4+
5+
6+
== Why?
7+
8+
I was using RMagick and loving it, but it was eating up huge amounts
9+
of memory. A simple script like this...
10+
11+
Magick::read("image.jpg") do |f|
12+
f.write("manipulated.jpg")
13+
end
14+
15+
...would use over 100 Megs of Ram. On my local machine this wasn't a
16+
problem, but on my hosting server the ruby apps would crash because of
17+
their 100 Meg memory limit.
18+
19+
20+
== Solution!
21+
22+
Using MiniMagick the ruby processes memory remains small (it spawns
23+
ImageMagick's command line program mogrify which takes up some memory
24+
as well, but is much smaller compared to RMagick)
25+
26+
MiniMagick gives you access to all the commandline options ImageMagick
27+
has (Found here http://www.imagemagick.org/script/mogrify.php)
28+
29+
30+
== Examples
31+
32+
Want to make a thumbnail from a file...
33+
34+
image = MiniMagick::Image.from_file("input.jpg")
35+
image.resize "100x100"
36+
image.write("output.jpg")
37+
38+
Want to make a thumbnail from a blob...
39+
40+
image = MiniMagick::Image.from_blob(blob)
41+
image.resize "100x100"
42+
image.write("output.jpg")
43+
44+
Need to combine several options?
45+
46+
image = MiniMagick::Image.from_file("input.jpg")
47+
image.combine_options do |c|
48+
c.sample "50%"
49+
c.rotate "-90>"
50+
end
51+
image.write("output.jpg")
52+
53+
Want to manipulate an image at its source (You won't have to write it
54+
out because the transformations are done on that file)
55+
56+
image = MiniMagick::Image.new("input.jpg")
57+
image.resize "100x100"
58+
59+
Want to get some meta-information out?
60+
61+
image = MiniMagick::Image.from_file("input.jpg")
62+
image[:width] # will get the width (you can also use :height and :format)
63+
image["EXIF:BitsPerSample"] # It also can get all the EXIF tags
64+
image["%m:%f %wx%h"] # Or you can use one of the many options of the format command
65+
66+
For more on the format command see
67+
http://www.imagemagick.org/script/command-line-options.php#format
68+
69+
70+
== Requirements
71+
72+
You must have ImageMagick installed.

‎README.txt

-97
This file was deleted.

‎Rakefile

100644100755
+40-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
require 'config/requirements'
2-
require 'config/hoe' # setup Hoe + all gem configuration
3-
4-
Dir['tasks/**/*.rake'].each { |rake| load rake }
1+
require 'rake'
2+
require 'rake/testtask'
3+
require 'rake/rdoctask'
4+
5+
$:.unshift(File.dirname(__FILE__) + "/lib")
6+
require 'mini_magick'
7+
8+
desc 'Default: run unit tests.'
9+
task :default => :test
10+
11+
desc 'Clean generated files.'
12+
task :clean => :clobber_rdoc do
13+
rm FileList['test/output/*.png']
14+
end
15+
16+
desc 'Test the mini_magick plugin.'
17+
Rake::TestTask.new(:test) do |t|
18+
t.libs << 'lib'
19+
t.pattern = 'test/**/*_test.rb'
20+
t.verbose = true
21+
end
22+
23+
desc 'Generate documentation for the mini_magick plugin.'
24+
Rake::RDocTask.new(:rdoc) do |rdoc|
25+
rdoc.rdoc_dir = 'rdoc'
26+
rdoc.title = 'MiniMagick'
27+
rdoc.options << '--line-numbers'
28+
rdoc.options << '--inline-source'
29+
rdoc.rdoc_files.include('README.rdoc')
30+
rdoc.rdoc_files.include('lib/**/*.rb')
31+
end
32+
33+
desc 'Update gemspec.'
34+
task :update_gemspec => :clean do
35+
files = `git-ls-files`.split
36+
data = File.read('mini_magick.gemspec')
37+
data.sub!(/^ s.version = .*$/, " s.version = #{MiniMagick::VERSION.inspect}")
38+
data.sub!(/^ s.files = .*$/, " s.files = %w(#{files.join(' ')})")
39+
open('mini_magick.gemspec', 'w'){|f| f.write(data)}
40+
end

‎config/hoe.rb

-70
This file was deleted.

‎config/requirements.rb

-17
This file was deleted.

‎lib/image_temp_file.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require "tempfile"
2+
3+
module MiniMagick
4+
class ImageTempFile < Tempfile
5+
def make_tmpname(ext, n)
6+
'mini_magick%d-%d%s' % [$$, n, ext ? ".#{ext}" : '']
7+
end
8+
end
9+
end

0 commit comments

Comments
 (0)
Please sign in to comment.