Code Monkey home page Code Monkey logo

ember-cli-image-transformer's Introduction

ember-cli-image-transformer

Build Status Ember Observer Score

Transform Images for your Ember Application from One Source Image

I hate having to create a bunch of identical images for use as icons and favicon images for my application, so I created this addon to take a single source image and transform it into many images of differing sizes, types, and backgrounds.

It is built using EmberJS and takes advantage of the awesome Sharp library to do the heavy lifting.

Compatibility

  • Ember.js v4.8 or above
  • Ember CLI v4.8 or above
  • Node.js v18 or above

Installation

ember install ember-cli-image-transformer

Usage

Create an ember-cli-image-transformer section in your ember-cli-build.js file with an images array. Each element in the array represents a different set of images to be generated.

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    'ember-cli-image-transformer': {
      images: [
        {
          inputFilename: 'public/square.svg',
          outputFileName: 'icon-square',
          convertTo: 'png',
          sizes: [16, 32, 45, 900],
        },
        {
          inputFilename: 'public/circle.svg',
          outputFileName: 'transparent-circle',
          convertTo: 'png',
          background: {r: 255, g: 255, b: 255, alpha: 0},
          sizes: [100],
        }
      ]
    }
  });

All generated images will be placed into the public/assets path of your application.

Usage in a template

<!-- application.hbs -->
<img src='assets/transparent-circle100.png'>

Image Options

Key Required Default Value Example Description
inputFileName ✔️ none public/circle.svg Where (relative to the application root) to find the input image
outputFileName ✔️ none transparent-circle This is combined with the convertTo and size to create the output file eg transparent-circle92.png
convertTo ✔️ none png The output file type
sizes ✔️ none [92, 150] An array of image sizes to produce
destination assets/icons images/wherever/you/want The destination directory for the output images relative to /public
background none {r: 255, g: 255, b: 255, alpha: 0} Add a background color to the image.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

ember-cli-image-transformer's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar ember-tomster avatar github-actions[bot] avatar greenkeeper[bot] avatar jrjohnson avatar sinankeskin avatar thecoolestguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-cli-image-transformer's Issues

An in-range update of sharp is breaking the build 🚨

Version 0.20.7 of sharp was just published.

Branch Build failing 🚨
Dependency sharp
Current Version 0.20.6
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

sharp is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 2 commits.

  • 5bed3a7 Release v0.20.7
  • ece1112 Use copy+unlink if rename fails during install #1345

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Sharp library causing high cpu usage on Windows

Hi.

First of all, thank you for this addon. Really useful.

On Windows if I delete dist folder and run ember app with ember s, nodejs using high cpu.

I investigated and found out that the reason is the Sharp library. Basically I guess Sharp process keeps open itself, never kills after success. And after the uninstall your addon high cpu usage is gone.

For the record, if I close the app (without the delete dist folder) and rerun again this issue is not happening. I guess skips the creating file.

And also this issue is not happening in Linux.

Thank you.

An in-range update of ember-cli-htmlbars is breaking the build 🚨

Version 2.0.4 of ember-cli-htmlbars was just published.

Branch Build failing 🚨
Dependency ember-cli-htmlbars
Current Version 2.0.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ember-cli-htmlbars is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 7 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-ember is breaking the build 🚨

The devDependency eslint-plugin-ember was updated from 5.3.0 to 5.4.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-ember is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 7 commits.

  • 390c39c 5.4.0
  • 7f159e6 Add v5.4.0 to CHANGELOG.
  • af63958 Merge pull request #314 from gmurphey/add-new-rules-to-index
  • 81a80a0 Adding missing rules to index.js. Fixes #313.
  • 37ecb40 Merge pull request #253 from twokul/needs
  • ba92b28 Reset recommended change until major bump.
  • 4ad5b86 avoid-using-needs rule

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of sharp is breaking the build 🚨

Version 0.20.5 of sharp was just published.

Branch Build failing 🚨
Dependency [sharp](https://github.com/lovell/sharp)
Current Version 0.20.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

sharp is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 6 commits.

  • 5cb3548 Release v0.20.5
  • 80189ed Add changelog and credit for #1265
  • 3d7e8ef Docs: update new Buffer() to Buffer.from() (#1273)
  • 1999c71 Docs: add CSS to improve left-hand nav nesting
  • 9c20ae3 Remove top of file table of contents in documentation (#1270)
  • 76c41ea Expose libjpeg optimize_coding flag (#1265)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ember-ajax is breaking the build 🚨

The devDependency ember-ajax was updated from 3.1.2 to 3.1.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ember-ajax is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 3 commits.

  • 430d11c chore(release): 3.1.4
  • ba9a87d test: add test case around relative URL conversion
  • daf8319 Revert "fix: don't append leading '/' when building url"

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.