added tons of features
This commit is contained in:
30
lib/module/image.ts
Normal file
30
lib/module/image.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import im from 'imagemagick'
|
||||
import fs from 'node:fs'
|
||||
|
||||
const originalImage =
|
||||
'w:\\share\\work\\sb528990\\data\\ВістаменЛібідо\\IMG_1928_Crop.JPG'
|
||||
|
||||
if (!fs.existsSync(originalImage)) {
|
||||
const sizes = [360, 640, 1024]
|
||||
|
||||
for (const i in sizes) {
|
||||
const size = sizes[i]
|
||||
const outImage = `w:\\share\\work\\sb528990\\data\\ВістаменЛібідо\\vistamen-libido-feature-${size}x${size}.jpg`
|
||||
im.resize(
|
||||
{
|
||||
srcPath: originalImage,
|
||||
dstPath: outImage,
|
||||
quality: 0.84,
|
||||
format: 'jpg',
|
||||
width: size,
|
||||
height: size,
|
||||
filter: 'sinc',
|
||||
strip: true
|
||||
},
|
||||
function (err: any) {
|
||||
if (err) throw err
|
||||
console.log(`resized IMG_1928_Crop.JPG to fit within ${size}x${size}px`)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user