Module: MiniMagick

Defined in:
lib/mini_magick.rb

Defined Under Namespace

Classes: CommandBuilder, Error, Image, Invalid

Constant Summary collapse

MOGRIFY_COMMANDS =
%w{adaptive-blur adaptive-resize adaptive-sharpen adjoin affine alpha annotate antialias append authenticate auto-gamma auto-level auto-orient background bench iterations bias black-threshold blue-primary blue-shift blur border bordercolor brightness-contrast caption cdl channel charcoal chop clip clamp clip-mask clip-path clone clut contrast-stretch coalesce colorize color-matrix colors colorspace combine comment compose composite compress contrast convolve coefficients crop cycle decipher debug define deconstruct delay delete density depth despeckle direction dissolve display dispose distort dither draw edge emboss encipher encoding endian enhance equalize evaluate evaluate-sequence extent extract family fft fill filter flatten flip floodfill flop font format frame function fuzz fx gamma gaussian-blur geometry gravity green-primary help identify ifft implode insert index intent interlace interline-spacing interpolate interword-spacing kerning label lat layers level limit linear-stretch liquid-rescale log loop mask mattecolor median modulate monitor monochrome morph morphology motion-blur negate noise normalize opaque ordered-dither orient page paint ping pointsize polaroid posterize precision preview print process profile quality quantize quiet radial-blur raise random-threshold red-primary regard-warnings region remap render repage resample resize respect-parentheses roll rotate sample sampling-factor scale scene seed segments selective-blur separate sepia-tone set shade shadow sharpen shave shear sigmoidal-contrast size sketch solarize splice spread strip stroke strokewidth stretch style swap swirl texture threshold thumbnail tile tile-offset tint transform transparent transparent-color transpose transverse treedepth trim type undercolor unique-colors units unsharp verbose version view vignette virtual-pixel wave weight white-point white-threshold write}
IMAGE_CREATION_OPERATORS =
%w{canvas caption gradient label logo pattern plasma radial radient rose text tile xc }

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.processorObject

Returns the value of attribute processor.



9
10
11
# File 'lib/mini_magick.rb', line 9

def processor
  @processor
end

.timeoutObject

Returns the value of attribute timeout.



10
11
12
# File 'lib/mini_magick.rb', line 10

def timeout
  @timeout
end

Class Method Details

.choose_processorObject

Experimental method for automatically selecting a processor such as gm. Only works on *nix.

TODO: Write tests for this and figure out what platforms it supports



17
18
19
20
21
22
23
# File 'lib/mini_magick.rb', line 17

def choose_processor
  if `type -P mogrify`.size > 0
    return
  elsif `type -P gm`.size > 0
    self.processor = "gm"
  end
end

.image_magick_versionObject



25
26
27
# File 'lib/mini_magick.rb', line 25

def image_magick_version
  @@version ||= Gem::Version.create(`mogrify --version`.split(" ")[2].split("-").first)
end

.minimum_image_magick_versionObject



29
30
31
# File 'lib/mini_magick.rb', line 29

def minimum_image_magick_version
  @@minimum_version ||= Gem::Version.create("6.6.3")
end

.valid_version_installed?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/mini_magick.rb', line 33

def valid_version_installed?
  image_magick_version >= minimum_image_magick_version
end