Class: ImageVise::SRGB

Inherits:
Object
  • Object
show all
Defined in:
lib/image_vise/operators/srgb.rb

Overview

Applies the sRGB profile to the image. For this to work, your ImageMagick must be built witl LCMS support. On OSX, you need to use the brew install command with the following options:

$brew install imagemagick --with-little-cms --with-little-cms2

You can verify if you do have LittleCMS support by checking the delegates list that ‘$convert –version` outputs:

For instance, if you do not have it, the list will look like this:

$ convert --version
...
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

whereas if you do, the list will include the “lcms” delegate:

$ convert --version
...
Delegates (built-in): bzlib freetype jng jpeg lcms ltdl lzma png tiff xml zlib

The corresponding Pipeline method is ‘srgb`.

Constant Summary collapse

PROFILE_PATH =
File.expand_path(__dir__ + '/sRGB_v4_ICC_preference_displayclass.icc')

Instance Method Summary collapse

Instance Method Details

#apply!(magick_image) ⇒ Object



26
27
28
29
30
31
# File 'lib/image_vise/operators/srgb.rb', line 26

def apply!(magick_image)
  magick_image.add_profile(PROFILE_PATH)
rescue Magick::ImageMagickError
  magick_image.strip!
  magick_image.add_profile(PROFILE_PATH)
end