image_magick 1.0.0
image_magick: ^1.0.0 copied to clipboard
Dart client for ImageMagick process-based inspect, resize, convert, and format discovery workflows.
example/image_magick_example.dart
import 'package:image_magick/image_magick.dart';
Future<void> main() async {
bool supported = await ImageMagickClient.isSupported();
if (!supported) {
print('ImageMagick is not installed or is not on PATH.');
return;
}
ImageMagickClient client = ImageMagickClient();
List<String> formats = await client.getSupportedFormats();
print('Supported formats: ${formats.join(', ')}');
print(await client.inspect(inputPath: '/tmp/input.png'));
print(
await client.resize(
inputPath: '/tmp/input.png',
outputPath: '/tmp/output.webp',
width: 1200,
height: 1200,
onlyShrink: true,
quality: 82,
format: 'webp',
),
);
print(
await client.crop(
inputPath: '/tmp/input.png',
outputPath: '/tmp/cropped.png',
width: 512,
height: 512,
x: 64,
y: 64,
format: 'png',
),
);
print(
await client.convert(
inputPath: '/tmp/input.png',
outputPath: '/tmp/output.jpg',
format: 'jpeg',
quality: 85,
),
);
print(
await client.rotate(
inputPath: '/tmp/input.png',
outputPath: '/tmp/rotated.png',
degrees: 90,
format: 'png',
),
);
print(
await client.stripMetadata(
inputPath: '/tmp/input.png',
outputPath: '/tmp/clean.webp',
format: 'webp',
),
);
}