sizeOf method

ImageDimension sizeOf(
  1. String filePath
)

Read the file and returns the width & heigth dimensions

Implementation

ImageDimension sizeOf(String filePath) {
  ext = path_lib.extension(filePath).toLowerCase();
  this.filePath = filePath;

  switch (ext) {
    case '.bmp':
      return BmpImage(loadCodeUnits()).calculate();
    case '.gif':
      return GifImage(loadCodeUnits()).calculate();
    case '.jpg':
      return JpgImage(loadCodeUnits()).calculate();
    case '.png':
      return PngImage(loadCodeUnits()).calculate();
    case '.psd':
      return PsdImage(loadCodeUnits()).calculate();
    case '.svg':
      return SvgImage(loadContents()).calculate();
    case '.webp':
      return WebpImage(loadCodeUnits()).calculate();
  }

  return null;
}