Method: DynamicImage::ImageProcessor#convert

Defined in:
lib/dynamic_image/image_processor.rb

#convert(new_format) ⇒ Object

Convert the image to a different format.



39
40
41
42
43
44
45
46
47
48
# File 'lib/dynamic_image/image_processor.rb', line 39

def convert(new_format)
  unless new_format.is_a?(DynamicImage::Format)
    new_format = DynamicImage::Format.find(new_format)
  end
  if frame_count > 1 && !new_format.animated?
    self.class.new(extract_frame(0), target_format: new_format)
  else
    self.class.new(image, target_format: new_format)
  end
end