broccoli-image-meta
Information
Process a source of images and generate a JSON with image metadata.
Why? For example, to create a component able to load a thumbnail or a colored box while the real image still loading.
Installation & usage
npm install --save broccoli-image-meta
// Rawconst ImageMeta = ;const color dimensions = ImageMeta; const myTree = 'assets/images';const thumbnailTree = myTree outputFile: 'meta.json' globs: '**/*.{jpg,jpeg,gif,png}' filters: color dimensions;
// Ember addon styleconst BroccoliImageMeta = ; moduleexports = // ... { return 'assets/images' /* options */ ; };
Options
Option | Type | Defaults | Description |
---|---|---|---|
outputFile | String |
meta.json |
Output file name |
extensions | Array |
['jpg', 'jpeg', 'gif', 'png'] |
Files to be processed |
filters | Array |
[] |
Image preprocessors |
persist | Boolean |
true |
Use disk cache |
formatOutput | Function |
(meta) => JSON.stringify(meta) |
Content to write inside the output file |
Filters
The filter is just a Function
that must return an Object
(promise compatible) and receiver an Entry
(an object with basePath
and relativePath
).
The object will be merged with the rest of the data created by other filters.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
See the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details