diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-07-26 17:10:43 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-07-26 17:10:43 +0900 |
| commit | 0f7fbacb17da69ca31608cd1d8dc29c3647dc205 (patch) | |
| tree | c383519bbaf1fb519596f03985e2f675b48e1ffb /src/services | |
| parent | 5.2.0 (diff) | |
| download | sharkey-0f7fbacb17da69ca31608cd1d8dc29c3647dc205.tar.gz sharkey-0f7fbacb17da69ca31608cd1d8dc29c3647dc205.tar.bz2 sharkey-0f7fbacb17da69ca31608cd1d8dc29c3647dc205.zip | |
Fix bug
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/drive/add-file.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index dd41f4462f..5cd1e9de59 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -242,17 +242,19 @@ export default async function( const calcAvg = async () => { log('calculate average color...'); - const info = await (img as any).stats(); + try { + const info = await (img as any).stats(); - const r = Math.round(info.channels[0].mean); - const g = Math.round(info.channels[1].mean); - const b = Math.round(info.channels[2].mean); + const r = Math.round(info.channels[0].mean); + const g = Math.round(info.channels[1].mean); + const b = Math.round(info.channels[2].mean); - log(`average color is calculated: ${r}, ${g}, ${b}`); + log(`average color is calculated: ${r}, ${g}, ${b}`); - const value = info.isOpaque ? [r, g, b] : [r, g, b, 255]; + const value = info.isOpaque ? [r, g, b] : [r, g, b, 255]; - properties['avgColor'] = value; + properties['avgColor'] = value; + } catch (e) { } }; propPromises = [calcWh(), calcAvg()]; |