load (GD2::Image)

    # File lib/gd2/image.rb, line 90
        def self.load(src)
          case src
          when File
            pos = src.pos
            magic = src.read(4)
            src.pos = pos
            create = {
              :jpeg => :gdImageCreateFromJpeg,
              :png  => :gdImageCreateFromPng,
              :gif  => :gdImageCreateFromGif,
              :wbmp => :gdImageCreateFromWBMP,
              :gd2  => :gdImageCreateFromGd2
            }
            args = [src.to_ptr]
          when String
            magic = src
            create = {
              :jpeg => :gdImageCreateFromJpegPtr,
              :png  => :gdImageCreateFromPngPtr,
              :gif  => :gdImageCreateFromGifPtr,
              :wbmp => :gdImageCreateFromWBMPPtr,
              :gd2  => :gdImageCreateFromGd2Ptr
            }
            args = [src.length, src]
          else
            raise TypeError, 'Unexpected argument type'
          end

          type = data_type(magic) or
            raise UnrecognizedImageTypeError, 'Image data format is not recognized'
          ptr = SYM[create[type]].call(*args)[0]
          raise LibraryError unless ptr

          init_image_ptr(ptr)

          image = (image_true_color?(ptr) ?
            TrueColor : IndexedColor).allocate.init_with_image(ptr)

          block_given? ? yield(image) : image
        end