image_whisperer 0.10.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 74

image_whisperer

Rotate and resize images before uploading as necessary.

Rotates the image according to the EXIF information so the image will look normal after reencoding or when they are displayed on a canvas.

Also images can be resized by specifying maximum width/height/pixels (as in maximum number of megapixels, but without the mega prefix).

Usage

Two types of images are used and supported: BlobImage and CanvasImage. BlobImage contains a dart:html Blob with the image data (image file contents), CanvasImage contains a CanvasElement with the image itself.

ImageProcessingPipeline pipeline = new ImageProcessingPipeline();
// The current version of the pipeline returns a BlobImage no matter what.
// Sets the output format to JPEG and the quality to 75.
pipeline.requireBlob("image/jpeg", quality: 75);
// The result should contain no more than 4096 pixels (which makes it quite small)
pipeline.maxPixels = 4096;
// Let's assume there's a `<input type="file"/>` field in the DOM and happens to
// have a nonempty value
FileUploadInputElement input = querySelector("input[type=file]");
File file = input.files.first;
BlobImage image = new BlobImage(file, name: file.name);
pipeline.process(image).then((BaseImage result) {
  // result is a BlobImage, and will always be with the default settings,
  // but I may change the API so we can receive a CanvasImage.
  Blob blob = (result as BlobImage).blob;

  // start a "download", so the image is saved

  String url;
  try {
    url = Url.createObjectUrl(blob);
    AnchorElement a = new AnchorElement();
    a.download = "${result.name}.resized.jpg";
    a.href = url;
    a.click();
  } finally {
    if (url != null) Url.revokeObjectUrl(url);
  }
});

Getting Started

Check out the https://github.com/skawa-universe/no_exif/ project for an example and details on how to deal with the pipeline and BaseImage objects.

0.10.0

  • bumped exifdart version
  • the library now requires Dart 2

0.9.4

  • bumped exifdart version

0.9.3+1

  • Added polyfill to fix IE11's lack of support of quality parameters in HTMLCanvasElement.toBlob

0.9.3

  • The pipeline can skip encoding the image to file and return with a CanvasImage (or a BlobImage if no adjustment was needed at all)

0.9.2

  • Added wrappers for Url.createObjectUrl and Url.revokeObjectUrl in BlobImage
  • Made a function private that was previously public by accident

0.9.1+2

  • Fixed handling of files without EXIF

0.9.1+1

Maintenance release.

0.9.1

  • Added the option to use the not really recommended native scaler: it applies no filters, the photos will look ugly. But it's fast.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  image_whisperer: ^0.10.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:image_whisperer/image_whisperer.dart';
  
Version Uploaded Documentation Archive
0.10.0 Aug 21, 2018 Go to the documentation of image_whisperer 0.10.0 Download image_whisperer 0.10.0 archive
0.9.3+1 Jan 31, 2018 Go to the documentation of image_whisperer 0.9.3+1 Download image_whisperer 0.9.3+1 archive
0.9.3 Nov 27, 2017 Go to the documentation of image_whisperer 0.9.3 Download image_whisperer 0.9.3 archive
0.9.2 Nov 27, 2017 Go to the documentation of image_whisperer 0.9.2 Download image_whisperer 0.9.2 archive
0.9.1+2 Nov 24, 2017 Go to the documentation of image_whisperer 0.9.1+2 Download image_whisperer 0.9.1+2 archive
0.9.1+1 Nov 23, 2017 Go to the documentation of image_whisperer 0.9.1+1 Download image_whisperer 0.9.1+1 archive
0.9.1 Nov 23, 2017 Go to the documentation of image_whisperer 0.9.1 Download image_whisperer 0.9.1 archive
0.9.0+2 Nov 23, 2017 Go to the documentation of image_whisperer 0.9.0+2 Download image_whisperer 0.9.0+2 archive
0.9.0+1 Nov 23, 2017 Go to the documentation of image_whisperer 0.9.0+1 Download image_whisperer 0.9.0+1 archive
0.9.0 Nov 23, 2017 Go to the documentation of image_whisperer 0.9.0 Download image_whisperer 0.9.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: web

Primary library: package:image_whisperer/image_whisperer.dart with components: html.

Health suggestions

Format lib/src/classes.dart.

Run dartfmt to format lib/src/classes.dart.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use image_whisperer.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
exifdart >=0.7.0 <0.8.0 0.7.0