Class: Morandi::ProfiledPixbuf

Inherits:
GdkPixbuf::Pixbuf show all
Defined in:
lib/morandi/profiled_pixbuf.rb

Overview

ProfiledPixbuf is a descendent of GdkPixbuf::Pixbuf with ICC support. It attempts to load an image using jpegicc/littlecms to ensure that it is sRGB. NOTE: pixbuf supports colour profiles, but it requires an explicit icc-profile option to embed it when saving file

Instance Method Summary collapse

Methods inherited from GdkPixbuf::Pixbuf

#scale_max, #to_cairo_image_surface

Constructor Details

#initialize(path, local_options, max_size_px = nil) ⇒ ProfiledPixbuf

Returns a new instance of ProfiledPixbuf.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/morandi/profiled_pixbuf.rb', line 11

def initialize(path, local_options, max_size_px = nil)
  @local_options = local_options

  path = srgb_path(path) || path

  if max_size_px
    super(file: path, width: max_size_px, height: max_size_px)
  else
    super(file: path)
  end
end