Module: CarrierWave::Processing::MiniMagick

Defined in:
lib/carrierwave-processing/mini_magick.rb

Instance Method Summary collapse

Instance Method Details

#auto_orientObject

Auto-orients the image

process :auto_orient


63
64
65
66
67
68
# File 'lib/carrierwave-processing/mini_magick.rb', line 63

def auto_orient
  manipulate! do |img|
    img.auto_orient
    img
  end
end

#blur(radius, sigma) ⇒ Object

reduce image noise and reduce detail levels

process :blur => [0, 8]


52
53
54
55
56
57
58
# File 'lib/carrierwave-processing/mini_magick.rb', line 52

def blur(radius, sigma)
  manipulate! do |img|
    img.blur "#{radius}x#{sigma}"
    img = yield(img) if block_given?
    img
  end
end

#colorspace(cs) ⇒ Object

Sets the colorspace of the image to the specified value.

process :colorspace => :rgb # force rgb
process :colorspace => :cmyk # force cmyk


33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/carrierwave-processing/mini_magick.rb', line 33

def colorspace(cs)
  manipulate! do |img|
    img.combine_options do |c|
      case cs.to_sym
      when :rgb
        c.colorspace "sRGB"
      when :cmyk
        c.colorspace "CMYK"
      end
    end
    img = yield(img) if block_given?
    img
  end
end

#quality(percentage) ⇒ Object

Reduces the quality of the image to the percentage given

process :quality => 90


20
21
22
23
24
25
26
# File 'lib/carrierwave-processing/mini_magick.rb', line 20

def quality(percentage)
  manipulate! do |img|
    img.quality(percentage.to_s)
    img = yield(img) if block_given?
    img
  end
end

#stripObject

Strips out all embedded information from the image

process :strip


8
9
10
11
12
13
14
# File 'lib/carrierwave-processing/mini_magick.rb', line 8

def strip
  manipulate! do |img|
    img.strip
    img = yield(img) if block_given?
    img
  end
end