class HexaPDF::ImageLoader::PNG

def with_io

Automatically handles files and IO streams.

Yields the IO object for reading the PNG image.
def with_io
  io = (@io.kind_of?(String) ? File.new(@io, 'rb') : @io)
  yield(io)
ensure
  io.close if @io.kind_of?(String)
end