README.md in mojo_magick-0.4.3 vs README.md in mojo_magick-0.4.4

- old
+ new

@@ -39,11 +39,11 @@ MojoMagick::resize('/img/infile.jpg', '/img/outfile.jpg', {:width=>100, :height=>100, :fill => true, :crop => true}) ### Code sample of how to shrink all jpg's in a folder require 'mojo_magick' - + image_folder = '/tmp/img' Dir::glob(File::join(image_folder, '*.jpg')).each do |image| begin # shrink all the images *in place* to no bigger than 60pix x 60pix MojoMagick::shrink(image, image, {:width => 60, :height => 60}) @@ -83,11 +83,11 @@ c.crop '250x250+0+0' c.repage! c.strip c.set 'comment', 'my favorite file' end - + # Equivalent to: MojoMagick::raw_command('convert', 'source.jpg -crop 250x250+0+0 +repage -strip -set comment "my favorite file" dest.jpg') ### using #mogrify @@ -98,29 +98,42 @@ MojoMagick::raw_command('mogrify', '-shave 10x10 image.jpg') # Example showing some additional options: # assuming binary data that is rgb, 8bit depth and 10x20 pixels, :format => :rgb, :depth => 8, :size => '10x20'OAu - + MojoMagick::convert do |c| c.file 'source.jpg' c.blob my_binary_data, :format => :rgb, :depth => 8, :size => '10x20' c.append c.crop '256x256+0+0' c.repage! c.file 'output.jpg' end - + # Use .file to specify file names, .blob to create and include a tempfile. The # bang (!) can be appended to command names to use the '+' versions # instead of '-' versions. ### Create a brand new image from data binary_data = '1111222233334444' MojoMagick::convert do |c| c.rgba8 binary_data, :format => :rgba, :depth => 8, :size => '2x2' c.file 'output.jpg' + end + +### Create a new image with text + +Note: Use with care. If you don't have fonts installed ImageMagick can spin off wildly leaving MojoMagick not knowing what to do. For Unix/MacOSX, you should install freetype and ghostscript. + + MojoMagick::convert(nil, fname) do |c| + c.background 'black' + c.fill 'white' + c.gravity 'center' + c.pointsize 80 + c.size '200x200' + c.label 'the bird is the word' end Availablility =============