#dart_image - Image and graphics library for server side applications.
The image library aims to provide server-side programs the ability to load, manipulate, and save various image file formats.
Simple usage example to load a jpeg, resize it, and save it as a jpeg.
import 'dart:io' as Io;
import 'package:dart_image/dart_image.dart';
main() {
Io.File file = new Io.File('res/cat-eye04.jpg');
file.openSync();
var bytes = file.readAsBytesSync();
if (bytes == null) {
return;
}
var jpegDecode = new JpegDecoder();
var image = jpegDecode.decode(bytes);
var thumbnail = image.resized(image.width ~/ 2, image.height ~/ 2);
var jpegEncode = new JpegEncoder(100);
var jpeg = jpegEncode.encode(thumbnail);
Io.File fp = new Io.File('res/thumbnail-cat-eye04.jpg');
fp.createSync(recursive: true);
fp.writeAsBytesSync(jpeg);
}
Add this to your package's pubspec.yaml file:
dependencies:
dart_image_01: ^1.0.3
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:dart_image_01/dart_image_01.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
1.0.3 | Dec 24, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
35
|
Health:
Code health derived from static analysis.
[more]
|
96
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
60
|
Overall:
Weighted score of the above.
[more]
|
58
|
We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, other
Primary library:
package:dart_image_01/dart_image_01.dart
with components:io
.
Fix lib/src/jpeg_encoder.dart
. (-1.49 points)
Analysis of lib/src/jpeg_encoder.dart
reported 3 hints:
line 61 col 13: The value of the local variable 'start' isn't used.
line 560 col 26: Avoid types as parameter names.
line 560 col 32: Avoid types as parameter names.
Fix lib/src/png_decoder.dart
. (-1.49 points)
Analysis of lib/src/png_decoder.dart
reported 3 hints:
line 17 col 15: The value of the local variable 'palette' isn't used.
line 23 col 12: The value of the local variable 'colorSpace' isn't used.
line 165 col 11: The value of the local variable 'crc' isn't used.
Fix lib/src/color.dart
. (-0.50 points)
Analysis of lib/src/color.dart
reported 1 hint:
line 11 col 19: Use isNotEmpty instead of length
Fix additional 10 files with analysis or formatting issues. (-0.50 points)
Additional issues in the following files:
lib/src/jpeg/_jpeg_data.dart
(1 hint)lib/src/_byte_buffer.dart
(Run dartfmt
to format lib/src/_byte_buffer.dart
.)lib/src/encoder.dart
(Run dartfmt
to format lib/src/encoder.dart
.)lib/src/image.dart
(Run dartfmt
to format lib/src/image.dart
.)lib/src/jpeg/_jpeg.dart
(Run dartfmt
to format lib/src/jpeg/_jpeg.dart
.)lib/src/jpeg/_jpeg_frame.dart
(Run dartfmt
to format lib/src/jpeg/_jpeg_frame.dart
.)lib/src/jpeg/_jpeg_scan.dart
(Run dartfmt
to format lib/src/jpeg/_jpeg_scan.dart
.)lib/src/jpeg_decoder.dart
(Run dartfmt
to format lib/src/jpeg_decoder.dart
.)lib/src/png_encoder.dart
(Run dartfmt
to format lib/src/png_encoder.dart
.)lib/src/tga_encoder.dart
(Run dartfmt
to format lib/src/tga_encoder.dart
.)Provide a file named CHANGELOG.md
. (-20 points)
Changelog entries help developers follow the progress of your package. See the example generated by stagehand
.
Homepage URL doesn't exist. (-20 points)
At the time of the analysis the homepage
field http://bitbucket.org/brendan_duncan/dart_image
was unreachable.
Maintain an example.
None of the files in the package's example/
directory matches known example patterns.
Common filename patterns include main.dart
, example.dart
, and dart_image_01.dart
. Packages with multiple examples should provide example/README.md
.
For more information see the pub package layout conventions.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=2.0.0 <3.0.0 | ||
benchmark_harness | ^1.0.5 | 1.0.5 |