{"skill":{"slug":"google-free-media-skill","displayName":"Google Free Media Skill","summary":"สร้างรูปภาพและวิดีโอ AI ฟรีผ่าน Google Gemini และ Google Flow โดยใช้ browser automation ไม่ต้องจ่าย API fee ใช้เมื่อต้องการสร้างสื่อ visual (รูปปก, thumbnail...","description":"---\nname: google-free-media\ndescription: สร้างรูปภาพและวิดีโอ AI ฟรีผ่าน Google Gemini และ Google Flow โดยใช้ browser automation ไม่ต้องจ่าย API fee ใช้เมื่อต้องการสร้างสื่อ visual (รูปปก, thumbnail, วิดีโอสั้น) โดยไม่เสียค่าใช้จ่าย\n---\n\n# Google Free Media Generator\n\nSkill สำหรับสร้างรูปภาพและวิดีโอ AI ฟรีผ่าน Google Gemini และ Google Flow โดยใช้ browser automation\n\n## 🎯 เมื่อไหร่ควรใช้ Skill นี้\n\nใช้เมื่อผู้ใช้ต้องการ:\n- สร้างรูปภาพ AI สำหรับ cover, thumbnail, banner\n- สร้างวิดีโอจากข้อความหรือรูปภาพ (text-to-video, image-to-video)\n- ประหยัดค่า API (0 บาท vs 1-3 บาท/รูป ผ่าน API ปกติ)\n- สร้างสื่อจำนวนมากโดยไม่กังวลเรื่องต้นทุน\n\n## ⚠️ ข้อจำกัดที่ต้องรู้\n\n1. **Quota ฟรีจำกัด**: Gemini ~100 รูป/วัน, Flow ~50 credits/วัน (อาจเปลี่ยนแปลง)\n2. **ช้ากว่า API**: ต้องเปิด browser และรอ UI load (5-10x ช้ากว่า)\n3. **เสี่ยง UI เปลี่ยน**: Google เปลี่ยนปุ่ม/ตำแหน่งบ่อย → อาจต้อง update skill\n4. **Terms of Service**: Automation อาจขัดกับ ToS ของ Google free tier\n\n## 📋 ขั้นตอนการทำงาน\n\n### 1. ตรวจสอบ Quota ก่อนเริ่ม\n```bash\nnode scripts/quota_manager.mjs check\n```\n- ดูว่าเหลือ quota เท่าไหร่\n- แจ้งเตือนถ้าใกล้หมด\n\n### 2. สร้างรูปภาพ (Gemini)\n```bash\nnode scripts/generate_image.mjs --prompt \"คำอธิบายรูป\" --output /path/to/output.jpg\n```\n\n**การทำงาน:**\n1. เปิด browser ไปยัง gemini.google.com\n2. Login (ถ้ายังไม่ได้ login)\n3. กดปุ่มสร้างรูป (Image generation)\n4. ส่ง prompt ที่ enhance แล้ว\n5. รอ generate และดึงรูป full resolution (=s0 trick)\n6. บันทึกลงไฟล์\n\n### 3. สร้างวิดีโอ (Google Flow)\n```bash\nnode scripts/generate_video.mjs --prompt \"คำอธิบายวิดีโอ\" --output /path/to/output.mp4\n```\n\n**การทำงาน:**\n1. เปิด browser ไปยัง labs.google/flow\n2. เลือกโหมด (Text-to-Video หรือ Image-to-Video)\n3. ส่ง prompt หรืออัพโหลดรูป\n4. รอ generate\n5. ดาวน์โหลดวิดีโอ\n\n## 🔧 Scripts\n\n### generate_image.mjs\nสร้างรูปภาพผ่าน Google Gemini\n\n**Arguments:**\n- `--prompt`: คำอธิบายรูป (required)\n- `--output`: path ไฟล์ output (required)\n- `--style`: style ของรูป (optional: realistic, artistic, minimalist)\n- `--enhance`: ให้ AI enhance prompt อัตโนมัติ (default: true)\n\n### generate_video.mjs\nสร้างวิดีโอผ่าน Google Flow (Veo 3.1)\n\n**Arguments:**\n- `--prompt`: คำอธิบายวิดีโอ (required)\n- `--output`: path ไฟล์ output (required)\n- `--mode`: โหมดการสร้าง (text-to-video, image-to-video)\n- `--image`: path รูปต้นทาง (สำหรับ image-to-video)\n- `--duration`: ระยะเวลาวิดีโอ (5-10 วินาที)\n\n### quota_manager.mjs\nจัดการและติดตาม quota การใช้งาน\n\n**Commands:**\n- `check`: ตรวจสอบ quota ที่เหลือ\n- `reset`: รีเซ็ต counter (เริ่มวันใหม่)\n- `log`: ดู log การใช้งาน\n\n**Config File:** `configs/quota.json`\n```json\n{\n  \"dailyLimits\": {\n    \"images\": 100,\n    \"videoCredits\": 50\n  },\n  \"currentUsage\": {\n    \"images\": 0,\n    \"videoCredits\": 0\n  },\n  \"lastReset\": \"2026-03-02T00:00:00+07:00\"\n}\n```\n\n## 💡 เทคนิคสำคัญ\n\n### 1. ดึงรูป Full Resolution\nรูปบน Gemini แสดงที่ 1024px แต่สามารถดึง full resolution (1408x768) ได้โดยเปลี่ยน URL:\n```\nจาก: https://.../image=s1024\nเป็น: https://.../image=s0\n```\n\n### 2. Session Persistence\n- Login ครั้งเดียวแล้วเก็บ cookie ไว้ใช้ต่อ\n- ไม่ต้อง login ใหม่ทุกครั้งที่สร้างรูป\n- ใช้ Puppeteer/Playwright session storage\n\n### 3. Prompt Enhancement\nก่อนส่งให้ Gemini ควร enhance prompt ให้มี:\n- Lighting (soft lighting, dramatic lighting, golden hour)\n- Composition (rule of thirds, centered, wide angle)\n- Style (photorealistic, cinematic, minimalist, vibrant)\n- Quality keywords (4K, ultra detailed, professional)\n\n**ตัวอย่าง:**\n```\nInput: \"รูปแมวใส่แว่น\"\nEnhanced: \"A photorealistic portrait of a cute cat wearing round glasses, \nsoft studio lighting, centered composition, professional photography, \n4K ultra detailed, warm tones\"\n```\n\n## 📁 Storage Organization\n\nไฟล์ที่สร้างจะเก็บที่:\n```\n/mnt/storage/ada_projects/ai_media/\n├── images/YYYY-MM/\n├── videos/YYYY-MM/\n└── metadata.json\n```\n\n## 🔄 Fallback Strategy\n\nถ้า Google ใช้ไม่ได้ มีทางเลือกสำรอง:\n1. Bing Image Creator (ฟรี)\n2. Leonardo.ai (ฟรี tier)\n3. Stable Diffusion Online\n\n## 🚨 การแก้ปัญหา\n\n### Login ไม่ได้\n- ตรวจสอบว่า browser ไม่ใช่ headless mode\n- ถ้าใช้ VPS ต้องตั้ง Xvfb เป็นจอเสมือน\n- ลอง clear cookie แล้ว login ใหม่\n\n### UI เปลี่ยน/ปุ่มหาย\n- Update selector ใน scripts\n- ตรวจสอบ Google เปลี่ยนตำแหน่งฟีเจอร์\n\n### Quota หมด\n- รอวันถัดไป (reset ตอน 00:00)\n- ใช้ fallback services แทน\n\n## 📝 ตัวอย่างการใช้งาน\n\n```bash\n# สร้างรูปปกโพสต์\nnode scripts/generate_image.mjs \\\n  --prompt \"AI workflow diagram, futuristic style, blue and purple gradient\" \\\n  --output /mnt/storage/ada_projects/ai_media/images/2026-03/cover_001.jpg \\\n  --style artistic\n\n# สร้างวิดีโอจากข้อความ\nnode scripts/generate_video.mjs \\\n  --prompt \"Ocean waves at sunset, cinematic slow motion\" \\\n  --output /mnt/storage/ada_projects/ai_media/videos/2026-03/sunset.mp4 \\\n  --duration 8\n\n# ตรวจสอบ quota\nnode scripts/quota_manager.mjs check\n```\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":561,"installsAllTime":21,"installsCurrent":1,"stars":0,"versions":1},"createdAt":1772732409466,"updatedAt":1778491738336},"latestVersion":{"version":"1.0.0","createdAt":1772732409466,"changelog":"Google Free Media Generator skill v1.0.0\n\n- Initial release: generate AI images (via Gemini) and videos (via Google Flow) for free using browser automation—no API fees required.\n- Manage daily quota usage automatically for both image and video generation.\n- Supports full-resolution image downloads and session persistence for faster logins.\n- Includes fallback options to Bing, Leonardo, and Stable Diffusion if Google is unavailable.\n- Comprehensive CLI scripts provided for image, video, and quota management.","license":null},"metadata":null,"owner":{"handle":"pbseiya","userId":"s17agcxbpe1rym186aqcr07845884r1w","displayName":"pbseiya","image":"https://avatars.githubusercontent.com/u/34887773?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089766910}}