生成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 | `[email protected]`
# 12.9-inch iPad Pro | 2732px by 2048px | `[email protected]`
#
# 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 [email protected]
magick $portrait -resize 1024x768 -gravity center -background white -extent 1024x768 Default-Landscape.png
magick $portrait -resize 2048x1536 -gravity center -background white -extent 2048x1536 [email protected]
magick $portrait -resize 768x1024 -gravity center -background white -extent 768x1024 Default-Portrait.png
magick $portrait -resize 1536x2048 -gravity center -background white -extent 1536x2048 [email protected]
# magick $portrait -resize 1080x1920 -gravity center -background white -extent 1080x1920 [email protected]
magick $portrait -resize 1242x2208 -gravity center -background white -extent 1242x2208 [email protected]
magick $portrait -resize 1125x2436 -gravity center -background white -extent 1125x2436 [email protected]
# magick $landscape -resize 1920x1080 -gravity center -background white -extent 1920x1080 [email protected]
magick $portrait -resize 750x1334 -gravity center -background white -extent 750x1334 [email protected]
# magick $landscape -resize 1334x750 -gravity center -background white -extent 1334x750 [email protected]
magick $portrait -resize 640x1136 -gravity center -background white -extent 640x1136 [email protected]
# magick $landscape -resize 1136x640 -gravity center -background white -extent 1136x640 [email protected]
# magick $landscape -resize 2048x2732 -gravity center -background white -extent 2048x2732 [email protected]
# magick $landscape -resize 2732x2048 -gravity center -background white -extent 2732x2048 [email protected]
# magick $portrait -resize 1536x2048 -gravity center -background white -extent 1536x2048 [email protected]
# magick $landscape -resize 2048x1536 -gravity center -background white -extent 2048x1536 [email protected]
magick $portrait -resize 2436x1125 -gravity center -background white -extent 2436x1125 [email protected]
magick $portrait -resize 2208x1242 -gravity center -background white -extent 2208x1242 [email protected]

# **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 | `[email protected]`
# iPad |	1024px by 768px | `Default-Landscape.png`
# iPad Retina |	2048px by 1536px | `[email protected]`
# iPad |	768px by 1024px | `Default-Portrait.png`
# iPad Retina |	1536px by 2048px | `[email protected]`
# iPhone 6s Plus, iPhone 6 Plus |	1080px by 1920px | `[email protected]`
# iPhone 6s Plus, iPhone 6 Plus |	1920px by 1080px | `[email protected]`
# iPhone 6s, iPhone 6 | 750px by 1334px | `[email protected]`
# iPhone 6s, iPhone 6 | 1334px by 750px | `[email protected]`
# iPhone SE | 640px by 1136px | `[email protected]`
# iPhone SE | 1136px by 640px | `[email protected]`
# 12.9-inch iPad Pro | 2048px by 2732px | `[email protected]`
# 12.9-inch iPad Pro | 2732px by 2048px | `[email protected]`
# 9.7-inch iPad Pro, iPad Air 2, iPad mini 4, iPad mini 2 | 1536px by 2048px | `[email protected]`
# 9.7-inch iPad Pro, iPad Air 2, iPad mini 4, iPad mini 2 | 2048px by 1536px | `[email protected]`
相关推荐
软***c5 分钟前
iPhone密码忘记了办?iPhoneUnlocker,iPhone解锁工具Aiseesoft iPhone Unlocker 高级注册版分享
ios·iphone·iphone 解锁
Digitally10 分钟前
如何将联系人从 iPhone 转移到 Android
android·ios·iphone
FreeBuf_15 分钟前
黑客利用iMessage零点击漏洞攻击iPhone用户
ios·iphone
EndingCoder42 分钟前
React Native 开发环境搭建(全平台详解)
javascript·react native·react.js·前端框架
安和昂1 小时前
【iOS】多线程NSOperation,NSOperationQueue
macos·ios·cocoa
程序员小张丶3 小时前
React Native在HarmonyOS 5.0阅读类应用开发中的实践
javascript·react native·react.js·阅读·harmonyos5.0
EndingCoder3 小时前
React Native 是什么?为什么学它?
javascript·react native·react.js
程序员小张丶4 小时前
基于React Native开发HarmonyOS 5.0主题应用技术方案
javascript·react native·react.js·主题·harmonyos5.0
wen's6 小时前
React Native 弹窗组件优化实战:解决 Modal 闪烁与动画卡顿问题
javascript·react native·react.js
pop_xiaoli16 小时前
OC—UI学习-2
学习·ui·ios