生成iOS LaunchImage脚本

组件

react-native-splash-screen

注意事项

脚本没有设置生成ios LaunchImage的路径,需要把图片复制到ios/YourProjectname/Images.xcassets/LaunchImage.launchimage

脚本

脚本来自己git上的一个用户,链接贴上了,我额外增加了一些比较新的分辨率。

javascript 复制代码
# https://gist.github.com/roblabs/d2c3536760755de7715d2248e7854444
#!/bin/bash -e

# --------------------------------------------------------
# Generate iOS Launch items from a single image
# (c) 2017 ePi Rational, Inc.
#
# Modified from original script which generated app icons for iOS,
# originally written by
# Ben Clayton, Calvium Ltd.
#  https://gist.github.com/benvium/2be6d673aa9ac284bb8a
# --------------------------------------------------------

# Process
# As of 2017, the largest launch screen for iOS is.
# 12.9-inch iPad Pro | 2048px by 2732px | `Default-1366h@2x.png`
# 12.9-inch iPad Pro | 2732px by 2048px | `Default-Landscape-1366h@2x.png`
#
# The idea is to create a portrait and landscape at the above sizes,
# then use ImageMagick to scale.
# ImageMagick steps
#   * create a white background with the desired image extent
#   * scale the large image, while tending towards the center
#   * testing showed that the `-resize` alone did not properly create the final image sizes.

# Check imagemagick is installed
# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
command -v magick >/dev/null 2>&1 || { echo >&2 "Requires imagemagick, but it's not installed.  See http://www.imagemagick.org.  Aborting."; exit 1; }

# Uses the largest images as the base image for generating the others
portrait="splash_20240809.png"
landscape="splash_20240809.png"

#magick $portrait -resize 320x480 -gravity center -background white -extent 320x480 Default.png
magick $portrait -resize 640x960 -gravity center -background white -extent 640x960 Default@2x.png
magick $portrait -resize 1024x768 -gravity center -background white -extent 1024x768 Default-Landscape.png
magick $portrait -resize 2048x1536 -gravity center -background white -extent 2048x1536 Default-Landscape@2x.png
magick $portrait -resize 768x1024 -gravity center -background white -extent 768x1024 Default-Portrait.png
magick $portrait -resize 1536x2048 -gravity center -background white -extent 1536x2048 Default-Portrait@2x.png
# magick $portrait -resize 1080x1920 -gravity center -background white -extent 1080x1920 Default-640h@3x.png
magick $portrait -resize 1242x2208 -gravity center -background white -extent 1242x2208 Default-Portrait-736h@3x.png
magick $portrait -resize 1125x2436 -gravity center -background white -extent 1125x2436 Default-Portrait-812h@3x.png
# magick $landscape -resize 1920x1080 -gravity center -background white -extent 1920x1080 Default-Landscape-640h@3x.png
magick $portrait -resize 750x1334 -gravity center -background white -extent 750x1334 Default-667h@2x.png
# magick $landscape -resize 1334x750 -gravity center -background white -extent 1334x750 Default-Landscape-667h@2x.png
magick $portrait -resize 640x1136 -gravity center -background white -extent 640x1136 Default-568h@2x.png
# magick $landscape -resize 1136x640 -gravity center -background white -extent 1136x640 Default-Landscape-568h@2x.png
# magick $landscape -resize 2048x2732 -gravity center -background white -extent 2048x2732 Default-1366h@2x.png
# magick $landscape -resize 2732x2048 -gravity center -background white -extent 2732x2048 Default-Landscape-1366h@2x.png
# magick $portrait -resize 1536x2048 -gravity center -background white -extent 1536x2048 Default-1024h@2x.png
# magick $landscape -resize 2048x1536 -gravity center -background white -extent 2048x1536 Default-Landscape-1024h@2x.png
magick $portrait -resize 2436x1125 -gravity center -background white -extent 2436x1125 Default-Landscape-812h@3x.png
magick $portrait -resize 2208x1242 -gravity center -background white -extent 2208x1242 Default-Landscape-736h@3x.png

# **Splash Screens** | Portrait & Landscape, [iOS Human Interface Guidelines](https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/) | ![](assets/README-2dc5de66.png)
# Default (Portrait)|	320px by 480px | `Default.png`
# Default (Portrait)|	640px by 960px | `Default@2x.png`
# iPad |	1024px by 768px | `Default-Landscape.png`
# iPad Retina |	2048px by 1536px | `Default-Landscape@2x.png`
# iPad |	768px by 1024px | `Default-Portrait.png`
# iPad Retina |	1536px by 2048px | `Default-Portrait@2x.png`
# iPhone 6s Plus, iPhone 6 Plus |	1080px by 1920px | `Default-640h@3x.png`
# iPhone 6s Plus, iPhone 6 Plus |	1920px by 1080px | `Default-Landscape-640h@3x.png`
# iPhone 6s, iPhone 6 | 750px by 1334px | `Default-667h@2x.png`
# iPhone 6s, iPhone 6 | 1334px by 750px | `Default-Landscape-667h@2x.png`
# iPhone SE | 640px by 1136px | `Default-568h@2x.png`
# iPhone SE | 1136px by 640px | `Default-Landscape-568h@2x.png`
# 12.9-inch iPad Pro | 2048px by 2732px | `Default-1366h@2x.png`
# 12.9-inch iPad Pro | 2732px by 2048px | `Default-Landscape-1366h@2x.png`
# 9.7-inch iPad Pro, iPad Air 2, iPad mini 4, iPad mini 2 | 1536px by 2048px | `Default-1024h@2x.png`
# 9.7-inch iPad Pro, iPad Air 2, iPad mini 4, iPad mini 2 | 2048px by 1536px | `Default-Landscape-1024h@2x.png`
相关推荐
恋猫de小郭11 小时前
Flutter Widget Preview 功能已合并到 master,提前在体验毛坯的预览支持
android·flutter·ios
点金石游戏出海16 小时前
每周资讯 | Krafton斥资750亿日元收购日本动画公司ADK;《崩坏:星穹铁道》新版本首日登顶iOS畅销榜
游戏·ios·业界资讯·apple·崩坏星穹铁道
旷世奇才李先生18 小时前
Swift 安装使用教程
开发语言·ios·swift
90后的晨仔18 小时前
Xcode16报错: SDK does not contain 'libarclite' at the path '/Applicati
ios
finger2448019 小时前
谈一谈iOS线程管理
ios·objective-c
Digitally19 小时前
如何将大型视频文件从 iPhone 传输到 PC
ios·iphone
梅名智20 小时前
IOS 蓝牙连接
macos·ios·cocoa
美狐美颜sdk1 天前
跨平台直播美颜SDK集成实录:Android/iOS如何适配贴纸功能
android·人工智能·ios·架构·音视频·美颜sdk·第三方美颜sdk
wen's1 天前
React Native 0.79.4 中 [RCTView setColor:] 崩溃问题完整解决方案
javascript·react native·react.js
恋猫de小郭1 天前
Meta 宣布加入 Kotlin 基金会,将为 Kotlin 和 Android 生态提供全新支持
android·开发语言·ios·kotlin