Skip to content

Commit

Permalink
gobbled up a bunch of remvees patches
Browse files Browse the repository at this point in the history
  • Loading branch information
probablycorey committed May 27, 2009
1 parent 56a4761 commit 88f0328
Show file tree
Hide file tree
Showing 32 changed files with 399 additions and 2,194 deletions.
4 changes: 0 additions & 4 deletions History.txt

This file was deleted.

5 changes: 3 additions & 2 deletions License.txt → MIT-LICENSE 100644 → 100755
@@ -1,4 +1,4 @@
Copyright (c) 2008 FIXME full name
Copyright (c) 2005 Corey Johnson probablycorey@gmail.com

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

16 changes: 0 additions & 16 deletions Manifest.txt

This file was deleted.

72 changes: 72 additions & 0 deletions README.rdoc
@@ -0,0 +1,72 @@
= MiniMagick

A ruby wrapper for ImageMagick command line.


== Why?

I was using RMagick and loving it, but it was eating up huge amounts
of memory. A simple script like this...

Magick::read("image.jpg") do |f|
f.write("manipulated.jpg")
end

...would use over 100 Megs of Ram. On my local machine this wasn't a
problem, but on my hosting server the ruby apps would crash because of
their 100 Meg memory limit.


== Solution!

Using MiniMagick the ruby processes memory remains small (it spawns
ImageMagick's command line program mogrify which takes up some memory
as well, but is much smaller compared to RMagick)

MiniMagick gives you access to all the commandline options ImageMagick
has (Found here http://www.imagemagick.org/script/mogrify.php)


== Examples

Want to make a thumbnail from a file...

image = MiniMagick::Image.from_file("input.jpg")
image.resize "100x100"
image.write("output.jpg")

Want to make a thumbnail from a blob...

image = MiniMagick::Image.from_blob(blob)
image.resize "100x100"
image.write("output.jpg")

Need to combine several options?

image = MiniMagick::Image.from_file("input.jpg")
image.combine_options do |c|
c.sample "50%"
c.rotate "-90>"
end
image.write("output.jpg")

Want to manipulate an image at its source (You won't have to write it
out because the transformations are done on that file)

image = MiniMagick::Image.new("input.jpg")
image.resize "100x100"

Want to get some meta-information out?

image = MiniMagick::Image.from_file("input.jpg")
image[:width] # will get the width (you can also use :height and :format)
image["EXIF:BitsPerSample"] # It also can get all the EXIF tags
image["%m:%f %wx%h"] # Or you can use one of the many options of the format command

For more on the format command see
http://www.imagemagick.org/script/command-line-options.php#format


== Requirements

You must have ImageMagick installed.
97 changes: 0 additions & 97 deletions README.txt

This file was deleted.

44 changes: 40 additions & 4 deletions Rakefile 100644 → 100755
@@ -1,4 +1,40 @@
require 'config/requirements'
require 'config/hoe' # setup Hoe + all gem configuration

Dir['tasks/**/*.rake'].each { |rake| load rake }
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

$:.unshift(File.dirname(__FILE__) + "/lib")
require 'mini_magick'

desc 'Default: run unit tests.'
task :default => :test

desc 'Clean generated files.'
task :clean => :clobber_rdoc do
rm FileList['test/output/*.png']
end

desc 'Test the mini_magick plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

desc 'Generate documentation for the mini_magick plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'MiniMagick'
rdoc.options << '--line-numbers'
rdoc.options << '--inline-source'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

desc 'Update gemspec.'
task :update_gemspec => :clean do
files = `git-ls-files`.split
data = File.read('mini_magick.gemspec')
data.sub!(/^ s.version = .*$/, " s.version = #{MiniMagick::VERSION.inspect}")
data.sub!(/^ s.files = .*$/, " s.files = %w(#{files.join(' ')})")
open('mini_magick.gemspec', 'w'){|f| f.write(data)}
end
70 changes: 0 additions & 70 deletions config/hoe.rb

This file was deleted.

17 changes: 0 additions & 17 deletions config/requirements.rb

This file was deleted.

9 changes: 9 additions & 0 deletions lib/image_temp_file.rb
@@ -0,0 +1,9 @@
require "tempfile"

module MiniMagick
class ImageTempFile < Tempfile
def make_tmpname(ext, n)
'mini_magick%d-%d%s' % [$$, n, ext ? ".#{ext}" : '']
end
end
end

0 comments on commit 88f0328

Please sign in to comment.