项目作者: sebinbenjamin

项目描述 :
Generates icon & splash screen for web projects. Supports Ionic/Angular/PWA style resource generation and svg sources !
高级语言: JavaScript
项目地址: git://github.com/sebinbenjamin/image-res-generator.git
创建时间: 2019-07-01T06:28:54Z
项目社区:https://github.com/sebinbenjamin/image-res-generator

开源协议:GNU General Public License v3.0

下载


image-res-generator

CircleCI build status
Codeclimate Issues
Codeclimate Maintainability
Depfu
Gitter Chat
License: GPL v3

Introduction

image-res-generator is an automatic icon and splash screen resizing tool designed for Angular, Ionic, Capacitor, Cordova, PhoneGap apps, PWAs, and general use. It resizes and copies your icon.png and splash.png files to the platform-specific directories.


Installation

To install the image-res-generator globally, run:

  1. npm install -g image-res-generator

This will make the irgen command available globally on your system.


Usage

Required Files

Place your icon and splash files in the ‘resources’ folder under the root of your project. Ensure they are at least 1024x1024 pixels for icons and 2732x2732 pixels for splash images.

  1. resources/
  2. ├── icon.png
  3. └── splash.png

Update: You can now use SVG vector images for both icon and splash files 🎉.

  1. resources/
  2. ├── icon.svg
  3. └── splash.svg

When creating a base splash image, ensure that the artwork fits within a square (1200x1200) at the center of the image (2732x2732).

Splash Screen Template

You can use this template provided by the Ionic team for easier splash creation.

Command Line Usage

To generate resized images, use:

  1. $ image-res-generator

or

  1. $ irgen

Note: While preserving source files, it overwrites previous output if any.

Options

  1. -V, --version output the version number
  2. -i, --icon [optional] optional icon file path
  3. (default: ./resources/icon.png)
  4. -s, --splash [optional] optional splash file path
  5. (default: ./resources/splash.png)
  6. -p, --platforms [optional] optional platform token comma-separated list
  7. available tokens: android, ios, windows, blackberry10, pwa
  8. (default: all platforms processed)
  9. -o, --outputDir [optional] optional output directory
  10. (default: ./resources/)
  11. -I, --makeIcon [optional] option to process icon files only
  12. -S, --makeSplash [optional] option to process splash files only
  13. -c, --crop [optional] option to crop images instead of the default 'resize' strategy
  14. -h, --help output usage information
  15. -d, --debug output debugging information

Best Practices

Automate with NPM Scripts

Add a script to your package.json to automate the image generation process with specific options. This saves time and avoids repetitive command typing.

Example:

  1. {
  2. "scripts": {
  3. "resgen": "irgen -p android,ios"
  4. }
  5. }

Now, you can run:

  1. npm run resgen

Supported Platforms

  • iOS
    • Icons
    • Splash screens
  • Android
    • Icons
    • Splash screens
  • Windows
    • Icons
    • Splash screens
  • Blackberry 10
    • Icons
  • PWAs
    • Icons

Roadmap

  • Copy assets to Android/iOS Capacitor folders.
  • Add options for crop resizing strategy.
  • Update image configurations for all platforms.
  • Add support for Capacitor.

Contributing

Thank you for your interest in contributing! Please read our contributing guidelines to get started.


Credits

This open-source project is made possible by the support of the amazing open-source community. Special thanks to:


License

This project is licensed under the GPLv3. See the LICENSE file for details.