1 | [![npm](https://img.shields.io/npm/v/pfp.lgbt-wrapper.svg)](https://www.npmjs.com/package/pfp.lgbt-wrapper)
|
2 | [![npm](https://img.shields.io/npm/dt/pfp.lgbt-wrapper.svg?maxAge=3600)](https://www.npmjs.com/package/pfp.lgbt-wrapper)
|
3 | [![install size](https://packagephobia.now.sh/badge?p=pfp.lgbt-wrapper)](https://packagephobia.now.sh/result?p=pfp.lgbt-wrapper)
|
4 |
|
5 | # pfp.lgbt Wrapper
|
6 |
|
7 | ## Installation
|
8 |
|
9 | ```
|
10 | npm i pfp.lgbt-wrapper
|
11 | ```
|
12 |
|
13 | Unofficial wrapper for [pfp.lgbt](https://pfp.lgbt)!
|
14 |
|
15 | ## Usage
|
16 |
|
17 | #### Get all available flags
|
18 |
|
19 | Returns `Promise<Object>`
|
20 |
|
21 | ```ts
|
22 | getFlags();
|
23 | ```
|
24 |
|
25 | #### Get a flag's image
|
26 |
|
27 | Returns `Promise<Buffer>`
|
28 |
|
29 | ```ts
|
30 | getFlag(flag);
|
31 | ```
|
32 |
|
33 | #### Lgbtify an image
|
34 |
|
35 | Returns `Promise<Buffer>`
|
36 |
|
37 | Static
|
38 |
|
39 | ```js
|
40 | createStatic(
|
41 | image, // The image to lgbtify. A Buffer or an image url
|
42 | flag, // The Pride flag to add. A valid Pride flag
|
43 | type, // The effect type. Any of circle | overlay | square | background - Defaults to circle
|
44 | style, // The effect style. Any of solid | gradient - Defaults to solid
|
45 | format, // The output format. Any of jpg | png - Defaults to png
|
46 | alpha // The effect's alpha
|
47 | );
|
48 | ```
|
49 |
|
50 | Animated
|
51 |
|
52 | ```js
|
53 | createAnimated(
|
54 | image,
|
55 | flag,
|
56 | type, // Any of circle | square - Defaults to circle
|
57 | alpha
|
58 | );
|
59 | ```
|
60 |
|
61 | ## Examples
|
62 |
|
63 | #### Javascript
|
64 |
|
65 | ```js
|
66 | const PfPLGBT = require('pfp.lgbt-wrapper');
|
67 | const fs = require('fs');
|
68 |
|
69 | const pfp = new PfPLGBT();
|
70 |
|
71 | async function example() {
|
72 | pfp.getFlags().then(console.log);
|
73 |
|
74 | await pfp.getFlag('pan').then(result => fs.writeFileSync('./panFlag.png', result));
|
75 |
|
76 | pfp.createStatic(fs.readFileSync('./panFlag.png'), 'pride').then(result => fs.writeFileSync('./staticImage.png', result));
|
77 |
|
78 | pfp.createAnimated(fs.readFileSync('./panFlag.png'), 'pride', 'square', 100).then(result => fs.writeFileSync('./animatedImage.gif', result));
|
79 | }
|
80 |
|
81 | example();
|
82 | ```
|
83 |
|
84 | #### Typescript
|
85 |
|
86 | ```ts
|
87 | import PfPLGBT from 'pfp.lgbt-wrapper';
|
88 | import * as fs from 'fs';
|
89 |
|
90 | const pfp = new PfPLGBT();
|
91 |
|
92 | async function example() {
|
93 | pfp.getFlags().then(console.log);
|
94 |
|
95 | await pfp.getFlag('pan').then(result => fs.writeFileSync('./panFlag.png', result));
|
96 |
|
97 | pfp.createStatic(fs.readFileSync('./panFlag.png'), 'pride').then(result => fs.writeFileSync('./staticImage.png', result));
|
98 |
|
99 | pfp.createAnimated(fs.readFileSync('./panFlag.png'), 'pride', 'square', 100).then(result => fs.writeFileSync('./animatedImage.gif', result));
|
100 | }
|
101 |
|
102 | example();
|
103 | ```
|
104 |
|
105 | ## License
|
106 |
|
107 | pfp.lgbt-wrapper, an unofficial wrapper for pfp.lgbt
|
108 | Copyright (C) 2020 VenNeptury
|
109 |
|
110 | This program is free software: you can redistribute it and/or modify
|
111 | it under the terms of the GNU General Public License as published by
|
112 | the Free Software Foundation, either version 3 of the License, or
|
113 | (at your option) any later version.
|
114 |
|
115 | This program is distributed in the hope that it will be useful,
|
116 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
117 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
118 | GNU General Public License for more details.
|
119 |
|
120 | You should have received a copy of the GNU General Public License
|
121 | along with this program. If not, see <https://www.gnu.org/licenses/>.
|