@@ -13,6 +13,46 @@ Place the relevant files in the locations specified:
1313- ` public/splash-dark.png ` - for the Dark Mode splash screen
1414
1515### Requirements
16- - Format: PNG
16+ - Format: PNG (WebP is also accepted on Android, see below)
1717- Minimum Size/Ratio: 1080 × 1920 pixels
1818- GD PHP extension must be enabled, ensure it has enough memory (~ 2GB should be enough)
19+
20+ ## Android Image Format
21+
22+ <x-docs.version-badge since="4.6" />
23+
24+ When building for Android, NativePHP resizes your splash screens (and [ app icon] ( app-icon ) ) into a bitmap for every
25+ screen density. By default these are written as PNG files.
26+
27+ Full-screen splash images are large, and multiplied across five densities and two themes they can add tens of
28+ megabytes to your app bundle. Google Play Console flags this under "Optimize your app's images".
29+
30+ To ship smaller files, set the ` image_format ` option under the ` android ` key in ` config/nativephp.php ` to ` webp ` :
31+
32+ ``` php
33+ 'android' => [
34+ 'image_format' => env('NATIVEPHP_ANDROID_IMAGE_FORMAT', 'png'),
35+ ],
36+ ```
37+
38+ ``` dotenv
39+ NATIVEPHP_ANDROID_IMAGE_FORMAT=webp
40+ ```
41+
42+ - ` png ` - Default. Compressed PNG files.
43+ - ` webp ` - Lossless WebP files. Same visual output, usually 80-90% smaller than PNG.
44+
45+ When switching formats, the files from the previous format are removed on the next build, so you won't get
46+ duplicate resource errors.
47+
48+ You may also supply ` public/splash.webp ` and ` public/splash-dark.webp ` as sources for Android. When both a ` .webp `
49+ and a ` .png ` exist, the ` .webp ` is used.
50+
51+ <aside >
52+
53+ WebP output requires your PHP GD extension to be compiled with WebP support. If it isn't, NativePHP falls back to
54+ PNG output instead of failing the build. You can check with ` php -r "var_dump(function_exists('imagewebp'));" ` .
55+
56+ iOS always uses the PNG files, so keep ` public/splash.png ` and ` public/splash-dark.png ` if you build for iOS.
57+
58+ </aside >
0 commit comments