Skip to content

Commit ba378f7

Browse files
update image scripts
1 parent 3da246e commit ba378f7

File tree

1 file changed

+2
-33
lines changed

1 file changed

+2
-33
lines changed

docs/platforms/apple/guides/ios/size-analysis/insights.mdx

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ Contents/Resources/DWARF/${EXECUTABLE_NAME}
143143
npm install -g imagemin-cli
144144

145145
# Optimize PNG with quality 85
146-
imagemin input.png --plugin=pngquant --plugin.quality=[0.85,0.85] > output.png
146+
npx imagemin input.png --plugin=pngquant --pngquant.quality=0.85-0.85 > output.png
147147

148148
# Optimize JPEG with quality 85
149-
imagemin input.jpg --plugin=mozjpeg --plugin.quality=85 > output.jpg
149+
npx imagemin input.jpg --plugin=mozjpeg --plugin.mozjpeg.quality=85 > output.jpg
150150
```
151151

152152
#### Option 2: Use ImageOptim (GUI)
@@ -167,8 +167,6 @@ Open the image in Preview, choose `File → Export`, pick `HEIC`, and save. Repl
167167
2. Run `source optimize.sh`.
168168
3. Call `optimize_icon YourIcon.png`.
169169

170-
#### Option: Convert to HEIC
171-
172170
```bash
173171
#!/bin/bash
174172
optimize_icon() {
@@ -199,35 +197,6 @@ optimize_icon() {
199197

200198
Update the Info.plist alternate icon entry to point at the new `.heic` file.
201199

202-
#### Option: Keep PNG
203-
204-
```bash
205-
#!/bin/bash
206-
optimize_icon() {
207-
local input="$1"
208-
local output="$(basename "$input" | sed 's/\.[^.]*$//')_optimized.png"
209-
210-
[ ! -f "$input" ] && echo "❌ File not found: $input" && return 1
211-
212-
echo "🔄 Optimizing $(basename "$input")..."
213-
214-
sips --resampleWidth 180 "$input" \
215-
--out /tmp/icon.png >/dev/null 2>&1 || return 1
216-
sips --resampleWidth 1024 /tmp/icon.png \
217-
--out "$output" >/dev/null 2>&1
218-
219-
rm /tmp/icon.png
220-
221-
if [ -f "$output" ]; then
222-
local saved=$(( ($(stat -f%z "$input") - $(stat -f%z "$output")) / 1024 ))
223-
echo "✅ Saved ${saved}KB → $output"
224-
else
225-
echo "❌ Optimization failed"
226-
return 1
227-
fi
228-
}
229-
```
230-
231200
### Loose Images
232201

233202
**What it is**: Finds scaled @1x/@2x/@3x images stored outside of asset catalogs. This prevents app thinning from removing variants not needed for the user's device.

0 commit comments

Comments
 (0)