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.
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.
- image_cropper
A Flutter plugin for Android, iOS and Web supports cropping images
84Compare - image_picker_ios
iOS implementation of the image_picker plugin.
81Compare - image_picker_android
Android implementation of the image_picker plugin for selecting photos and videos.
81Compare - image_picker_windows
Windows implementation of image_picker for selecting images and videos
70Compare
Works with
Packages commonly used together with image_size_getter: ones it builds on, ones built on it, and its own family.
- flutter_image_compressSame familyCompress pictures using native code to effectively reduce image size.
- image_editorSame familyEdit image data with native Android, iOS, and macOS code and output to file or memory.
- stream_chat_flutterBuilt on image_size_getterFull-featured Flutter UI SDK for Stream Chat, providing ready‑made chat widgets and theming.