Tools: Allow generating Android images using generate-imgae script

This commit is contained in:
Laurent Cozic
2025-12-09 10:53:57 +00:00
parent 5f1a1e50d9
commit c669a3986e
15 changed files with 110 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -220,4 +220,8 @@ tablature
REVO
REVOGB
Bopomofo
Linkosed
Linkosed
mdpi
xhdpi
xxhdpi
xxxhdpi

View File

@@ -85,6 +85,33 @@
"13_81d4e1a631a97f3db0d033de420f14df_packages/app-mobile/ios/Joplin/Images.xcassets/AppIcon.appiconset/ios_dark83.5x83.5@2x.png_167_167____": true,
"1_80abab89a0e638b5a3f12f96ab5c8792_packages/app-mobile/ios/Joplin/Images.xcassets/AppIcon.appiconset/ios1024x1024.png_1024_1024____": true,
"13_81d4e1a631a97f3db0d033de420f14df_packages/app-mobile/ios/Joplin/Images.xcassets/AppIcon.appiconset/ios_dark1024x1024.png_1024_1024____": true,
"icns_to_icon_set_89ddfe84307b49fa96580655b5d7c045_216bb492f34224f24aabacb5f98c3620_fe652082bfb7427cd5c74566ecc24322_ebf1ccaf3f5b77b01ff690b763a411f9_216bb492f34224f24aabacb5f98c3620_950b970a784b14c329e09e78af827a77_ebf1ccaf3f5b77b01ff690b763a411f9_d33dafc8081155149dd1d8c1713bf03f_950b970a784b14c329e09e78af827a77_94949c497e46ed0c67082175f5bb22f8": true
"icns_to_icon_set_89ddfe84307b49fa96580655b5d7c045_216bb492f34224f24aabacb5f98c3620_fe652082bfb7427cd5c74566ecc24322_ebf1ccaf3f5b77b01ff690b763a411f9_216bb492f34224f24aabacb5f98c3620_950b970a784b14c329e09e78af827a77_ebf1ccaf3f5b77b01ff690b763a411f9_d33dafc8081155149dd1d8c1713bf03f_950b970a784b14c329e09e78af827a77_94949c497e46ed0c67082175f5bb22f8": true,
"14_6e6cb2bafe25a76d7f5db1d5a89e13a8_packages/app-mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png_162_162____": true,
"15_9839fc5c612bcb9c989a8f41cd3bc4fb_packages/app-mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png_162_162____": true,
"16_8b49a5b2155493c8591854123dcaec92_packages/app-mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png_72_72____": true,
"17_383019a3bc5c3ee9d2db2a72e3974294_packages/app-mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png_72_72____": true,
"14_6e6cb2bafe25a76d7f5db1d5a89e13a8_packages/app-mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png_108_108____": true,
"15_9839fc5c612bcb9c989a8f41cd3bc4fb_packages/app-mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png_108_108____": true,
"16_8b49a5b2155493c8591854123dcaec92_packages/app-mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png_48_48____": true,
"17_383019a3bc5c3ee9d2db2a72e3974294_packages/app-mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png_48_48____": true,
"14_6e6cb2bafe25a76d7f5db1d5a89e13a8_packages/app-mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png_216_216____": true,
"15_9839fc5c612bcb9c989a8f41cd3bc4fb_packages/app-mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png_216_216____": true,
"16_8b49a5b2155493c8591854123dcaec92_packages/app-mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png_96_96____": true,
"17_383019a3bc5c3ee9d2db2a72e3974294_packages/app-mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png_96_96____": true,
"14_6e6cb2bafe25a76d7f5db1d5a89e13a8_packages/app-mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png_324_324____": true,
"15_9839fc5c612bcb9c989a8f41cd3bc4fb_packages/app-mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png_324_324____": true,
"16_8b49a5b2155493c8591854123dcaec92_packages/app-mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png_144_144____": true,
"17_383019a3bc5c3ee9d2db2a72e3974294_packages/app-mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png_144_144____": true,
"14_6e6cb2bafe25a76d7f5db1d5a89e13a8_packages/app-mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png_432_432____": true,
"15_9839fc5c612bcb9c989a8f41cd3bc4fb_packages/app-mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png_432_432____": true,
"16_8b49a5b2155493c8591854123dcaec92_packages/app-mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png_192_192____": true,
"17_383019a3bc5c3ee9d2db2a72e3974294_packages/app-mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png_192_192____": true,
"15_c89378b53387531b8f91cc885caebfac_packages/app-mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png_162_162____": true,
"15_c89378b53387531b8f91cc885caebfac_packages/app-mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png_108_108____": true,
"15_c89378b53387531b8f91cc885caebfac_packages/app-mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png_216_216____": true,
"15_c89378b53387531b8f91cc885caebfac_packages/app-mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png_324_324____": true,
"15_c89378b53387531b8f91cc885caebfac_packages/app-mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png_432_432____": true,
"14_6e6cb2bafe25a76d7f5db1d5a89e13a8_packages/app-mobile/android/app/src/main/res/drawable/ic_launcher_background.png_1024_1024____": true,
"18_9839fc5c612bcb9c989a8f41cd3bc4fb_packages/app-mobile/android/app/src/main/res/drawable/ic_launcher_foreground.png_572_752____": true
}
}

View File

@@ -102,6 +102,26 @@ const sources: Source[] = [
id: 13,
name: '../JoplinLetterBlue.svg',
},
{
id: 14,
name: 'Android/ic_launcher_background.png',
},
{
id: 15,
name: 'Android/ic_launcher_foreground.png',
},
{
id: 16,
name: 'Android/ic_launcher_round.png',
},
{
id: 17,
name: 'Android/ic_launcher.png',
},
{
id: 18,
name: 'Android/ic_launcher_foreground_drawable.png',
},
];
function sourceById(id: number) {
@@ -117,6 +137,61 @@ const iOSReadAppIcon = async (filePath: string): Promise<iOSAppIconContents> =>
return JSON.parse(content) as iOSAppIconContents;
};
const getAndroidOperations = () => {
const output: Operation[] = [];
const targetFolders = {
'mipmap-hdpi': [72, 162],
'mipmap-mdpi': [48, 108],
'mipmap-xhdpi': [96, 216],
'mipmap-xxhdpi': [144, 324],
'mipmap-xxxhdpi': [192, 432],
};
for (const [folderName, sizes] of Object.entries(targetFolders)) {
output.push({
source: 14,
dest: `packages/app-mobile/android/app/src/main/res/${folderName}/ic_launcher_background.png`,
width: sizes[1],
height: sizes[1],
});
output.push({
source: 15,
dest: `packages/app-mobile/android/app/src/main/res/${folderName}/ic_launcher_foreground.png`,
width: sizes[1],
height: sizes[1],
});
output.push({
source: 16,
dest: `packages/app-mobile/android/app/src/main/res/${folderName}/ic_launcher_round.png`,
width: sizes[0],
height: sizes[0],
});
output.push({
source: 17,
dest: `packages/app-mobile/android/app/src/main/res/${folderName}/ic_launcher.png`,
width: sizes[0],
height: sizes[0],
});
}
output.push({
source: 14,
dest: 'packages/app-mobile/android/app/src/main/res/drawable/ic_launcher_background.png',
width: 1024,
height: 1024,
});
output.push({
source: 18,
dest: 'packages/app-mobile/android/app/src/main/res/drawable/ic_launcher_foreground.png',
width: 572,
height: 752,
});
return output;
};
const getOperations = async (rootDir: string): Promise<Operation[]> => {
const iOSAppIconSet = 'packages/app-mobile/ios/Joplin/Images.xcassets/AppIcon.appiconset';
const iOSAppIconSetContents = await iOSReadAppIcon(`${rootDir}/${iOSAppIconSet}/Contents.json`);
@@ -499,6 +574,8 @@ const getOperations = async (rootDir: string): Promise<Operation[]> => {
dest: 'packages/server/public/images/icons/cloud/favicon.ico',
images: ['joplinCloud32'],
},
...getAndroidOperations(),
];
};