@ryuu-reinzz/haruka-lib 2.0.3 → 2.0.5

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.
@@ -1,6 +1,7 @@
1
- import { Image } from 'node-webpmux';
1
+ import web from 'node-webpmux';
2
2
  import { TextEncoder } from 'util';
3
3
  import RawMetadata from './RawMetadata.js';
4
+ const WebP = web;
4
5
  export default class Exif {
5
6
  constructor(options) {
6
7
  this.exif = null;
@@ -22,7 +23,7 @@ export default class Exif {
22
23
  image instanceof Image
23
24
  ? image
24
25
  : await (async () => {
25
- const img = new Image();
26
+ const img = new WebP();
26
27
  await img.load(image);
27
28
  return img;
28
29
  })();
@@ -1,4 +1,4 @@
1
- import sharp, { fit } from 'sharp';
1
+ import sharp from 'sharp';
2
2
  import videoToGif from './videoToGif.js';
3
3
  import fs from 'fs-extra';
4
4
  import { tmpdir } from 'os';
@@ -25,18 +25,18 @@ const convert = async (data, mime, { quality = 100, background = defaultBg, type
25
25
  switch (type) {
26
26
  case StickerTypes.CROPPED:
27
27
  img.resize(512, 512, {
28
- fit: fit.cover
28
+ fit: sharp.fit.cover
29
29
  });
30
30
  break;
31
31
  case StickerTypes.FULL:
32
32
  img.resize(512, 512, {
33
- fit: fit.contain,
33
+ fit: sharp.fit.contain,
34
34
  background
35
35
  });
36
36
  break;
37
37
  case StickerTypes.CIRCLE:
38
38
  img.resize(512, 512, {
39
- fit: fit.cover
39
+ fit: sharp.fit.cover
40
40
  }).composite([
41
41
  {
42
42
  input: Buffer.from(`<svg width="512" height="512"><circle cx="256" cy="256" r="256" fill="${background}"/></svg>`),
@@ -48,7 +48,7 @@ const convert = async (data, mime, { quality = 100, background = defaultBg, type
48
48
  break;
49
49
  case StickerTypes.ROUNDED:
50
50
  img.resize(512, 512, {
51
- fit: fit.cover
51
+ fit: sharp.fit.cover
52
52
  }).composite([
53
53
  {
54
54
  input: Buffer.from(`<svg width="512" height="512"><rect rx="50" ry="50" width="512" height="512" fill="${background}"/></svg>`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-reinzz/haruka-lib",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Library extra for bot WhatsApp",
5
5
  "main": "main/index.js",
6
6
  "type": "module",