Skip to content
pubscout

image_size_getter

2.4.1, released a year ago by fluttercandies.com

Get image width and height by reading metadata without fully decoding the file.

WASM-ready
$ flutter pub add image_size_getter
Source repository

What it does

Reads dimensions and orientation metadata from JPEG, GIF, PNG, WebP, and BMP images without completely decoding the file. Supports custom inputs and custom decoders.

AI-written summary of version 2.4.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to quickly check image dimensions before uploading or displaying.
  • You want to optimize performance by avoiding full image decoding just to read its size.

Skip it when

  • You need to manipulate, crop, or transform the image pixels.
  • You are working with formats other than JPEG, GIF, PNG, WebP, and BMP unless you write a custom decoder.

Strengths

  • High performance because it only reads metadata/headers.
  • Supports multiple input sources like files, memory, and http.
  • Extensible through custom decoders and inputs.

Weaknesses

  • Limited to a specific set of image formats out of the box.
  • Requires converting Flutter asset images to Uint8List before processing.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
3
import 'dart:io';
import 'package:image_size_getter/image_size_getter.dart';
import 'package:image_size_getter/file_input.dart';

void main() async {
  final file = File('asset/IMG_20180908_080245.jpg');
  final result = ImageSizeGetter.getSizeResult(FileInput(file));
  print('Size: ${result.size}');
}

Alternatives

Packages that do the same job and could replace image_size_getter.

Works with

Packages commonly used together with image_size_getter: ones it builds on, ones built on it, and its own family.