From 6ffa7acd923a7b79447604ab319db6d1a770ad70 Mon Sep 17 00:00:00 2001
From: Paul McClean
Date: Wed, 24 Aug 2016 10:59:01 +0100
Subject: [PATCH] fix: Fix background transparency for ico and png
When using a SVG source image, ImageMagick (v6.7.7-10) will always
apply a white background to the resulting ico and png images.
This commit adds the -transparent none argument to the convert
program to ensure that the background remains transparent.
---
tasks/favicons.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tasks/favicons.js b/tasks/favicons.js
index a5301d7..0feeb2b 100644
--- a/tasks/favicons.js
+++ b/tasks/favicons.js
@@ -181,7 +181,7 @@ module.exports = function(grunt) {
if (fs.existsSync(lowResolutionImagePath)) {
src = lowResolutionImagePath;
}
- convert([src, '-resize', size, saveTo]);
+ convert(['-background none', src, '-resize', size, saveTo]);
files.push(saveTo);
});
grunt.log.ok();
@@ -198,7 +198,7 @@ module.exports = function(grunt) {
// 64x64 favicon.png higher priority than .ico
grunt.log.write('favicon.png... ');
- convert([source, '-resize', "64x64", path.join(f.dest, 'favicon.png')]);
+ convert(['-background none', source, '-resize', "64x64", path.join(f.dest, 'favicon.png')]);
grunt.log.ok();
}
@@ -265,7 +265,7 @@ module.exports = function(grunt) {
convert(combine(source, f.dest, "192x192", "homescreen-192x192.png", additionalOpts));
grunt.log.ok();
}
-
+
// Android Icons app
if (options.androidIcons) {
// 36x36: LDPI