0.1.9 • Published 6 years ago
kcimage v0.1.9
kcimage
Setup
yarn add kcimage
npm i -S kcimage
Usage
画像ダウンロード
プロジェクトルートディレクトリに images フォルダが生成されます
yarn run download-kcimages
npx download-kcimages
画像リサイズ&圧縮
プロジェクトルートディレクトリに compressed フォルダが生成されます
yarn run compress-kcimages
npx compress-kcimages
API
downloadImages(saveLocation = 'images', delay = 300, targets = defaultTargets)
compressImages(
inputLocation = 'images',
compressedFileOutput = 'compressed',
targets = defaultTargets,
options = defaultOptions
)
// defaultOptions = {
// scale: 0.667,
// quality: '30-40',
// speed: 1
// }
// https://github.com/imagemin/imagemin-pngquant
defaultTargets = [
{
target: 'ship',
ids: api_mst_ship.map(({ api_id }) => api_id), // 必要ならここにidを追加することで画像を追加取得できる
abyssalBound: 1500,
types: ['banner', 'banner_dmg', 'full', 'full_dmg', 'card', 'card_dmg', 'supply_character', 'supply_character_dmg'],
abyssalTypes: ['banner', 'full'],
compressedTypes: ['banner']
},
{
target: 'slotitem',
ids: api_mst_slotitem.map(({ api_id }) => api_id),
abyssalBound: 500,
types: [
'card',
'item_on',
'item_character',
'item_up',
'statustop_item',
'btxt_flat',
'airunit_banner',
'airunit_name',
'airunit_fairy'
],
abyssalTypes: ['btxt_flat', 'item_up'],
compressedTypes: ['item_on']
}
]
References
https://gist.github.com/sanaehirotaka/c177c39c37ba09b3642705a0be5e2465
https://github.com/Nishisonic/NodeItemImage