image_whisperer 0.9.3+1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 80

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.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.9.3+1"

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.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

Analysis

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

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
60 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
80
Learn more about scoring.

Platforms

Detected platforms: web

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

Suggestions

  • The description is too short.

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

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    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.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
exifdart >=0.5.0+2 <0.6.0 0.5.0+6