Skip to content

Commit

Permalink
update log
Browse files Browse the repository at this point in the history
meowtec committed Sep 12, 2017
1 parent b68e5fa commit ada96b1
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/backend/imagemagick.ts
Original file line number Diff line number Diff line change
@@ -10,13 +10,13 @@ export const detectImageMagick = async () => {
const { stdout } = await exec('magick -version')

if (stdout.indexOf('ImageMagick') === -1) {
log.error('magick detect error, stdout is:', stdout)
log.warn('magick detect error, stdout is:', stdout)
return false
}

return true
} catch (err) {
log.error('magick detect error', err)
log.warn('magick detect error', err)
return false
}
}
6 changes: 3 additions & 3 deletions modules/backend/optimize.ts
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ const optimize = async (
try {
dest.size = await fu.getSize(destPath)
} catch (err) {
log.info('optimize', `miss target: ${destPath}, will execute optimization.`, )
log.info('optimize', `miss cache (desk)`, )

/**
* pngquant on linux / windows does not support JPEG to PNG.
@@ -41,15 +41,15 @@ const optimize = async (
if (platform !== 'darwin' && image.ext === 'jpg' && exportExt === 'png') {
log.info(
'optimize',
'pngquant cannot read JPEG on Windows, will have an intermediate step that convert JPEG to PNG'
'should use ImageMagick for converting JPEG to PNG'
)

const intermediate = sourcePath.replace(/\.jpg$/, '.1.png')

try {
await fs.access(intermediate)
} catch (err) {
log.info('optimize', `never intermediate: ${intermediate}, will do via ImageMagick.`, )
log.info('optimize', `miss cache (ImageMagick)`, )
await convert(sourcePath, intermediate)
}

0 comments on commit ada96b1

Please sign in to comment.