pic 2.1.41

image #

Build Status

Overview #

A Dart library providing the ability to load, save and manipulate images in a variety of different file formats.

The library has no reliance on dart:io, so it can be used for both server and web applications.

Supported Image Formats:

Read/Write:

  • PNG / Animated APNG
  • JPEG
  • Targa
  • GIF / Animated GIF
  • PVR(PVRTC)

Read Only:

  • WebP / Animated WebP
  • TIFF
  • Photoshop PSD
  • OpenEXR

Documentation #

API #

Examples #

Format Decoding Functions #

Samples #

Load an image, resize it, and save it as a png:

import 'dart:io';
import 'package:pic/pic.dart';
void main() {
  // Read an image from file (webp in this case).
  // decodeImage will identify the format of the image and use the appropriate
  // decoder.
  Image image = decodeImage(File('test.webp').readAsBytesSync());

  // Resize the image to a 120x? thumbnail (maintaining the aspect ratio).
  Image thumbnail = copyResize(image, width: 120);

  // Save the thumbnail as a PNG.
  File('thumbnail.png')..writeAsBytesSync(encodePng(thumbnail));
}

Use this package as a library

1. Depend on it

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


dependencies:
  pic: ^2.1.41

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


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

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:pic/pic.dart.

Health suggestions

Format lib/pic.dart.

Run dartfmt to format lib/pic.dart.

Format lib/src/bitmap_font.dart.

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

Format lib/src/colorAdvanced.dart.

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

Fix additional 44 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/draw/draw_char.dart (Run dartfmt to format lib/src/draw/draw_char.dart.)
  • lib/src/draw/draw_circle.dart (Run dartfmt to format lib/src/draw/draw_circle.dart.)
  • lib/src/draw/draw_image.dart (Run dartfmt to format lib/src/draw/draw_image.dart.)
  • lib/src/draw/draw_line.dart (Run dartfmt to format lib/src/draw/draw_line.dart.)
  • lib/src/draw/draw_string.dart (Run dartfmt to format lib/src/draw/draw_string.dart.)
  • lib/src/draw/fill_flood.dart (Run dartfmt to format lib/src/draw/fill_flood.dart.)
  • lib/src/effects/drop_shadow.dart (Run dartfmt to format lib/src/effects/drop_shadow.dart.)
  • lib/src/filter/adjust_color.dart (Run dartfmt to format lib/src/filter/adjust_color.dart.)
  • lib/src/filter/bump_to_normal.dart (Run dartfmt to format lib/src/filter/bump_to_normal.dart.)
  • lib/src/filter/color_offset.dart (Run dartfmt to format lib/src/filter/color_offset.dart.)
  • lib/src/filter/contrast.dart (Run dartfmt to format lib/src/filter/contrast.dart.)
  • lib/src/filter/noise.dart (Run dartfmt to format lib/src/filter/noise.dart.)
  • lib/src/filter/pixelate.dart (Run dartfmt to format lib/src/filter/pixelate.dart.)
  • lib/src/filter/quantize.dart (Run dartfmt to format lib/src/filter/quantize.dart.)
  • lib/src/filter/separable_kernel.dart (Run dartfmt to format lib/src/filter/separable_kernel.dart.)
  • lib/src/formats/gif_encoder.dart (Run dartfmt to format lib/src/formats/gif_encoder.dart.)
  • lib/src/formats/jpeg_encoder.dart (Run dartfmt to format lib/src/formats/jpeg_encoder.dart.)
  • lib/src/formats/png_decoder.dart (Run dartfmt to format lib/src/formats/png_decoder.dart.)
  • lib/src/formats/png_encoder.dart (Run dartfmt to format lib/src/formats/png_encoder.dart.)
  • lib/src/formats/psd/psd_image.dart (Run dartfmt to format lib/src/formats/psd/psd_image.dart.)
  • lib/src/formats/psd/psd_layer.dart (Run dartfmt to format lib/src/formats/psd/psd_layer.dart.)
  • lib/src/formats/pvrtc/pvrtc_color.dart (Run dartfmt to format lib/src/formats/pvrtc/pvrtc_color.dart.)
  • lib/src/formats/pvrtc/pvrtc_color_bounding_box.dart (Run dartfmt to format lib/src/formats/pvrtc/pvrtc_color_bounding_box.dart.)
  • lib/src/formats/pvrtc/pvrtc_decoder.dart (Run dartfmt to format lib/src/formats/pvrtc/pvrtc_decoder.dart.)
  • lib/src/formats/pvrtc/pvrtc_encoder.dart (Run dartfmt to format lib/src/formats/pvrtc/pvrtc_encoder.dart.)
  • lib/src/formats/tiff/tiff_image.dart (Run dartfmt to format lib/src/formats/tiff/tiff_image.dart.)
  • lib/src/formats/webp/vp8.dart (Run dartfmt to format lib/src/formats/webp/vp8.dart.)
  • lib/src/formats/webp/vp8_filter.dart (Run dartfmt to format lib/src/formats/webp/vp8_filter.dart.)
  • lib/src/formats/webp/vp8l.dart (Run dartfmt to format lib/src/formats/webp/vp8l.dart.)
  • lib/src/formats/webp_decoder.dart (Run dartfmt to format lib/src/formats/webp_decoder.dart.)
  • lib/src/hdr/hdr_to_image.dart (Run dartfmt to format lib/src/hdr/hdr_to_image.dart.)
  • lib/src/internal/clamp.dart (Run dartfmt to format lib/src/internal/clamp.dart.)
  • lib/src/pic.dart (Run dartfmt to format lib/src/pic.dart.)
  • lib/src/transform/copy_crop.dart (Run dartfmt to format lib/src/transform/copy_crop.dart.)
  • lib/src/transform/copy_into.dart (Run dartfmt to format lib/src/transform/copy_into.dart.)
  • lib/src/transform/copy_rectify.dart (Run dartfmt to format lib/src/transform/copy_rectify.dart.)
  • lib/src/transform/copy_resize.dart (Run dartfmt to format lib/src/transform/copy_resize.dart.)
  • lib/src/transform/copy_resize_crop_square.dart (Run dartfmt to format lib/src/transform/copy_resize_crop_square.dart.)
  • lib/src/transform/copy_rotate.dart (Run dartfmt to format lib/src/transform/copy_rotate.dart.)
  • lib/src/transform/trim.dart (Run dartfmt to format lib/src/transform/trim.dart.)
  • lib/src/util/input_buffer.dart (Run dartfmt to format lib/src/util/input_buffer.dart.)
  • lib/src/util/interpolation.dart (Run dartfmt to format lib/src/util/interpolation.dart.)
  • lib/src/util/octree_quantizer.dart (Run dartfmt to format lib/src/util/octree_quantizer.dart.)
  • lib/src/util/point.dart (Run dartfmt to format lib/src/util/point.dart.)

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and pic.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.49.0 <3.0.0
archive >=1.0.16 <3.0.0 2.0.10
xml >=3.2.5 <4.0.0 3.5.0
Transitive dependencies
args 1.5.2
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.2
meta 1.1.7
path 1.6.4
petitparser 2.4.0
typed_data 1.1.6
Dev dependencies
build_runner >=1.3.0 <2.0.0
build_web_compilers >=0.3.6 <2.0.0
pedantic ^1.0.0
test >=0.12.42 <2.0.0