diff --git a/Assets/Joplin.ico b/Assets/ImageSources/Joplin.ico similarity index 100% rename from Assets/Joplin.ico rename to Assets/ImageSources/Joplin.ico diff --git a/Assets/ImageSources/macOS_1024x1024.png b/Assets/ImageSources/RoundedCorners_1024x1024.png similarity index 100% rename from Assets/ImageSources/macOS_1024x1024.png rename to Assets/ImageSources/RoundedCorners_1024x1024.png diff --git a/Assets/ImageSources/macOS_16x16.png b/Assets/ImageSources/RoundedCorners_16x16.png similarity index 100% rename from Assets/ImageSources/macOS_16x16.png rename to Assets/ImageSources/RoundedCorners_16x16.png diff --git a/Assets/ImageSources/macOS_64x64.png b/Assets/ImageSources/RoundedCorners_64x64.png similarity index 100% rename from Assets/ImageSources/macOS_64x64.png rename to Assets/ImageSources/RoundedCorners_64x64.png diff --git a/ElectronClient/package.json b/ElectronClient/package.json index 3ce74f33c..7b0f2a99a 100644 --- a/ElectronClient/package.json +++ b/ElectronClient/package.json @@ -28,7 +28,7 @@ "win": { "asar": true, "rfc3161TimeStampServer": "http://sha256timestamp.ws.symantec.com/sha256/timestamp", - "icon": "../../Assets/Joplin.ico", + "icon": "../../Assets/ImageSources/Joplin.ico", "target": [ { "target": "nsis", diff --git a/Tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg b/Tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg index 252c16948..419dcc07a 100644 Binary files a/Tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg and b/Tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg differ diff --git a/Tools/PortableAppsLauncher/App/AppInfo/appicon.ico b/Tools/PortableAppsLauncher/App/AppInfo/appicon.ico index a5e1174e2..7b2f3737c 100644 Binary files a/Tools/PortableAppsLauncher/App/AppInfo/appicon.ico and b/Tools/PortableAppsLauncher/App/AppInfo/appicon.ico differ diff --git a/Tools/PortableAppsLauncher/App/AppInfo/appicon_128.png b/Tools/PortableAppsLauncher/App/AppInfo/appicon_128.png index 2e25758b6..ee29f5503 100644 Binary files a/Tools/PortableAppsLauncher/App/AppInfo/appicon_128.png and b/Tools/PortableAppsLauncher/App/AppInfo/appicon_128.png differ diff --git a/Tools/PortableAppsLauncher/App/AppInfo/appicon_16.png b/Tools/PortableAppsLauncher/App/AppInfo/appicon_16.png index 9a4198a76..e2b9ab257 100644 Binary files a/Tools/PortableAppsLauncher/App/AppInfo/appicon_16.png and b/Tools/PortableAppsLauncher/App/AppInfo/appicon_16.png differ diff --git a/Tools/PortableAppsLauncher/App/AppInfo/appicon_32.png b/Tools/PortableAppsLauncher/App/AppInfo/appicon_32.png index 679aa6e67..f218ec146 100644 Binary files a/Tools/PortableAppsLauncher/App/AppInfo/appicon_32.png and b/Tools/PortableAppsLauncher/App/AppInfo/appicon_32.png differ diff --git a/Tools/PortableAppsLauncher/App/AppInfo/appicon_75.png b/Tools/PortableAppsLauncher/App/AppInfo/appicon_75.png index 6e59021c2..a79971f8f 100644 Binary files a/Tools/PortableAppsLauncher/App/AppInfo/appicon_75.png and b/Tools/PortableAppsLauncher/App/AppInfo/appicon_75.png differ diff --git a/Tools/generate-images.js b/Tools/generate-images.js index 477775f5a..839c68131 100644 --- a/Tools/generate-images.js +++ b/Tools/generate-images.js @@ -1,6 +1,10 @@ +require('app-module-path').addPath(`${__dirname}/../ReactNativeClient`); + const dirname = require('path').dirname; const sharp = require('sharp'); +const fs = require('fs-extra'); const { execCommand } = require('./tool-utils.js'); +const { fileExtension } = require('lib/path-utils'); const sources = [ { @@ -9,15 +13,19 @@ const sources = [ }, { id: 2, - name: 'macOS_16x16.png', + name: 'RoundedCorners_16x16.png', }, { id: 3, - name: 'macOS_64x64.png', + name: 'RoundedCorners_64x64.png', }, { id: 4, - name: 'macOS_1024x1024.png', + name: 'RoundedCorners_1024x1024.png', + }, + { + id: 5, + name: 'Joplin.ico', }, ]; @@ -207,6 +215,41 @@ const operations = [ width: 1024, height: 1024, }, + + + + { + source: 5, + dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon.ico', + }, + { + source: 2, + dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_16.png', + }, + { + source: 3, + dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_32.png', + width: 32, + height: 32, + }, + { + source: 4, + dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_75.png', + width: 75, + height: 75, + }, + { + source: 4, + dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_128.png', + width: 128, + height: 128, + }, + { + source: 4, + dest: 'Tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg', + width: 144, + height: 144, + }, ]; async function main() { @@ -219,15 +262,36 @@ async function main() { const sourcePath = `${sourceImageDir}/${source.name}`; const destPath = `${rootDir}/${operation.dest}`; - sharp(sourcePath) - .resize(operation.width, operation.height, { fit: 'fill' }) - .toFile(destPath); + const sourceExt = fileExtension(sourcePath).toLowerCase(); + const destExt = fileExtension(destPath).toLowerCase(); + + if ((operation.width && operation.height) || (sourceExt !== destExt)) { + let s = sharp(sourcePath); + + if (operation.width && operation.height) { + s = s.resize(operation.width, operation.height, { fit: 'fill' }); + } + + if (destExt === 'jpg') { + s.jpeg({ quality: 90 }); + } else if (destExt === 'png') { + s.png(); + } else { + throw new Error(`Unsupported extension: ${destExt}`); + } + + s = s.toFile(destPath); + } else { + await fs.copyFile(sourcePath, destPath); + } } - const icnsDest = `${rootDir}/Assets/macOs.icns`; - const icnsSource = `${rootDir}/Assets/macOs.iconset`; - console.info(`iconutil -c icns -o "${icnsDest}" "${icnsSource}"`); - await execCommand(`iconutil -c icns -o "${icnsDest}" "${icnsSource}"`); + if (process && process.platform === 'darwin') { + const icnsDest = `${rootDir}/Assets/macOs.icns`; + const icnsSource = `${rootDir}/Assets/macOs.iconset`; + console.info(`iconutil -c icns -o "${icnsDest}" "${icnsSource}"`); + await execCommand(`iconutil -c icns -o "${icnsDest}" "${icnsSource}"`); + } } main().catch((error) => {