Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.75 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.75 KB

react-native-gen-tool

Description :

CLI tool for react native developers to generate icons based on an image, Both Android and Ios are supported

const rect = new Buffer.from(
`<svg><rect x="0" y="0" width="${Number(
Object.values(item),
)}" height="${Number(Object.values(item))}" rx="8" ry="8"/></svg>`,
);

Install :

npm i -g rn-icon-gen-tool

Usage

generate-icons --help
Usage: --out [dir] --img [image] --fit [(cover)|contain|fill|inside|outside] --platform [(both)|android|ios]

Options:
  --version   Show version number                                      [boolean]
  -h, --help  Show help                                                [boolean]
  -o, --out   Output directory
                           [string] [required] [default: "android/app/src/main"]
  -i, --img   Images to convert                              [string] [required]
  -f, --fit   Image should be resized to fit both provided dimensions
   [choices: "cover", "contain", "fill", "inside", "outside"] [default: "cover"]
  -p, --platform to generate icons based on target platform  
   [choices: "both", "android", "ios"] [default: "both"]
Fit option :

cover: (default) Preserving aspect ratio, ensure the image covers both provided dimensions by cropping/clipping to fit.

contain: Preserving aspect ratio, contain within both provided dimensions using "letterboxing" where necessary.

fill: Ignore the aspect ratio of the input and stretch to both provided dimensions.

inside: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.

outside: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.