@shibam/sticker-maker 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -111,11 +111,16 @@ var ToWebp = function (buffer, metaInfo, mimeExt, mimeType) { return __awaiter(v
111
111
  fit: sharp_1.fit.fill
112
112
  });
113
113
  }
114
+ else {
115
+ res.resize(512, 512, {
116
+ fit: sharp_1.fit.contain,
117
+ });
118
+ }
114
119
  return [2 /*return*/, res
115
120
  .toFormat('webp')
116
121
  .webp({
117
122
  quality: metaInfo.quality,
118
- lossless: true
123
+ lossless: mimeExt.includes('gif') ? false : true
119
124
  })
120
125
  .toBuffer()];
121
126
  case 4:
@@ -24,10 +24,4 @@ export default class Exif {
24
24
  * @returns A Promise that resolves to a Buffer containing the image with the added Exif data.
25
25
  */
26
26
  add: (image: Buffer | Image.Image) => Promise<Buffer>;
27
- /**
28
- * Loads the image from a Buffer or string and returns an Image instance.
29
- * @param image - A Buffer or string representing the image to be loaded.
30
- * @returns A Promise that resolves to an Image instance.
31
- */
32
- load: (image: Buffer | string) => Promise<Image.Image>;
33
27
  }
@@ -77,6 +77,7 @@ var Exif = /** @class */ (function () {
77
77
  */
78
78
  this.add = function (image) { return __awaiter(_this, void 0, void 0, function () {
79
79
  var exif, _a;
80
+ var _this = this;
80
81
  return __generator(this, function (_b) {
81
82
  switch (_b.label) {
82
83
  case 0:
@@ -84,7 +85,19 @@ var Exif = /** @class */ (function () {
84
85
  if (!(image instanceof node_webpmux_1.default.Image)) return [3 /*break*/, 1];
85
86
  _a = image;
86
87
  return [3 /*break*/, 3];
87
- case 1: return [4 /*yield*/, this.load(image)
88
+ case 1: return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
89
+ var img;
90
+ return __generator(this, function (_a) {
91
+ switch (_a.label) {
92
+ case 0:
93
+ img = new node_webpmux_1.default.Image();
94
+ return [4 /*yield*/, img.load(image)];
95
+ case 1:
96
+ _a.sent();
97
+ return [2 /*return*/, img];
98
+ }
99
+ });
100
+ }); })()
88
101
  // Set the Exif data on the image and save it.
89
102
  ];
90
103
  case 2:
@@ -100,24 +113,6 @@ var Exif = /** @class */ (function () {
100
113
  }
101
114
  });
102
115
  }); };
103
- /**
104
- * Loads the image from a Buffer or string and returns an Image instance.
105
- * @param image - A Buffer or string representing the image to be loaded.
106
- * @returns A Promise that resolves to an Image instance.
107
- */
108
- this.load = function (image) { return __awaiter(_this, void 0, void 0, function () {
109
- var img;
110
- return __generator(this, function (_a) {
111
- switch (_a.label) {
112
- case 0:
113
- img = new node_webpmux_1.default.Image();
114
- return [4 /*yield*/, img.load(image)];
115
- case 1:
116
- _a.sent();
117
- return [2 /*return*/, img];
118
- }
119
- });
120
- }); };
121
116
  this.data['sticker-pack-id'] = options.id || '';
122
117
  this.data['sticker-pack-name'] = options.pack || '';
123
118
  this.data['sticker-pack-publisher'] = options.author || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shibam/sticker-maker",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A package for creating stickers",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",