Gera e configura ícones PWA otimizados e quadrados para dispositivos móveis
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 551 KiB |
+2
-2
@@ -11,7 +11,7 @@
|
|||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
<meta name="apple-mobile-web-app-title" content="Camila AI">
|
<meta name="apple-mobile-web-app-title" content="Camila AI">
|
||||||
<link rel="apple-touch-icon" href="/assets/camila_prof.png">
|
<link rel="apple-touch-icon" href="/assets/apple-touch-icon.png">
|
||||||
<title>Camila AI</title>
|
<title>Camila AI</title>
|
||||||
<!-- Google Fonts Outfit & Inter -->
|
<!-- Google Fonts Outfit & Inter -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<!-- Favicon customizado -->
|
<!-- Favicon customizado -->
|
||||||
<link rel="icon" href="/assets/camila_prof.png" type="image/png">
|
<link rel="icon" href="/assets/icon-192.png" type="image/png">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
"orientation": "portrait-primary",
|
"orientation": "portrait-primary",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/assets/camila_prof.png",
|
"src": "/assets/icon-192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/assets/camila_prof.png",
|
"src": "/assets/icon-512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import os
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
def generate_icons():
|
||||||
|
img_path = '/root/Apps/Camila/public/assets/camila_prof.png'
|
||||||
|
if not os.path.exists(img_path):
|
||||||
|
print(f"Error: {img_path} not found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
img = Image.open(img_path)
|
||||||
|
width, height = img.size
|
||||||
|
print(f"Original image size: {width}x{height}")
|
||||||
|
|
||||||
|
# Crop to a square. The face is usually in the upper half of the image.
|
||||||
|
# Original is 498x741. Let's crop a square of 498x498.
|
||||||
|
# Let's start the crop from y=50 to y=548 to keep the face well-centered.
|
||||||
|
size = min(width, height)
|
||||||
|
left = (width - size) // 2
|
||||||
|
top = 50 # Offset down slightly to avoid cropping the top of the head
|
||||||
|
right = left + size
|
||||||
|
bottom = top + size
|
||||||
|
|
||||||
|
if bottom > height:
|
||||||
|
bottom = height
|
||||||
|
top = height - size
|
||||||
|
|
||||||
|
cropped_img = img.crop((left, top, right, bottom))
|
||||||
|
print(f"Cropped to square: {cropped_img.size}")
|
||||||
|
|
||||||
|
# Target directory
|
||||||
|
assets_dir = '/root/Apps/Camila/public/assets'
|
||||||
|
os.makedirs(assets_dir, exist_ok=True)
|
||||||
|
|
||||||
|
# Save sizes
|
||||||
|
sizes = {
|
||||||
|
180: 'apple-touch-icon.png',
|
||||||
|
192: 'icon-192.png',
|
||||||
|
512: 'icon-512.png'
|
||||||
|
}
|
||||||
|
|
||||||
|
for sz, filename in sizes.items():
|
||||||
|
resized = cropped_img.resize((sz, sz), Image.Resampling.LANCZOS)
|
||||||
|
out_path = os.path.join(assets_dir, filename)
|
||||||
|
resized.save(out_path, 'PNG')
|
||||||
|
print(f"Saved {sz}x{sz} icon to {out_path}")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
generate_icons()
|
||||||
Reference in New Issue
Block a user