Giter Club home page Giter Club logo

icons-asset-generator's Introduction

Icons Asset Generator for OmniGraffle and diagrams.net

Convert SVG images into:

Features:

  • parametrize connection points (magnets)
  • filter images by name
  • format icon names

See diagrams-aws-icons with generated AWS Architecture Icons library for diagrams.net.

Idea based on script from AWS-OmniGraffle-Stencils

Usage

Requires Python 3.8+ and Poetry.

Install dependencies in virtual env:

poetry install

Run:

poetry run icons-asset-generator \
    --path ./icons-directory [<common-args>] \
    <target-application> [<application-args>]

where <target-application> is one of:

  • diagrams.net
  • omnigraffle

Common options

  • --path - input files directory path
  • --output - output directory path (default: ./library)
  • --filename-includes - strings to filter image file name by, taking only those which contains them all; accepts multiple arguments
  • --filename-excludes - strings to filter image file name by, taking only those which do not contain any of them; accepts multiple arguments
  • --image-name-remove - strings to be removed from image file name (default: . - _); accepts multiple arguments
  • --library-name-remove - strings to be removed from library file name (default: . - _); accepts multiple arguments
  • --no-vertex-magnets - don't create connection points on vertices (corners)
  • --side-magnets - number of connection points for each side (default: 5)
  • --labels - add label with name to the images
  • --help - display help

All SVG files from the given path will be added to the output asset, recursively.

If you provide arguments accepting multiple arguments, put the --path argument last so the parser knows where arguments stop and parses <target-application> parameter correctly.

Diagrams.net specific options

  • --size - resize images to target size; accepts argument in format TYPE=NUMBER where TYPE is one of width, height, longest

OmniGraffle specific options

  • --text-output - write OmniGraffle data file as text instead of binary

If SVG files are grouped into directories, each root-level directory will become a separate group in the output Stencil.

For example, this structure:

svg/
├── Group 1/
│   ├── icon1.svg
│   ├── icon2.svg
│   ├── icon3.svg
└── Group 2/
    ├── icon4.svg
    └── Subgroup
        └── icon5.svg

would produce a Stencil with Group 1 with 3 icons and Group 2 with 2 icons.

Example: AWS Architecture Icons

To generate icons from AWS Architecture Icons download SVG zip file (example: Asset-Package_04302022) and unpack it.

Run:

poetry run icons-asset-generator \
    --filename-includes _48 \
    --filename-excludes Dark \
    --image-name-remove Light Arch_ Res_ _48 . - _  \
    --library-name-remove  . - _ \
    --path "./Asset-Package_04302022" \
    diagrams.net

Open diagrams.net and load created asset from the ./library directory.

icons-asset-generator's People

Contributors

lfittl avatar m-radzikowski avatar

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.