@ryuu-reinzz/haruka-lib 2.0.3 → 2.0.4
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,4 +1,4 @@
|
|
|
1
|
-
import 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>`),
|