Skip to content

Commit 99c2651

Browse files
committed
feat: Add orientation parameter for image and video generation; update documentation
1 parent f626a4c commit 99c2651

File tree

5 files changed

+294
-76
lines changed

5 files changed

+294
-76
lines changed

QUICK_REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ except Exception as e:
223223
## 🔗 Links
224224

225225
- **GitHub**: [mir-ashiq/meta-ai-python](https://github.com/mir-ashiq/metaai-api)
226-
- **PyPI**: [metaai-api](https://pypi.org/project/metaai-api/)
226+
- **PyPI**: [metaai-sdk](https://pypi.org/project/metaai-sdk/)
227227
- **Documentation**: [README.md](README.md)
228228
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
229229
- **Meta AI**: https://www.meta.ai/

QUICK_USAGE.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@ metadata = {'file_size': result['file_size'], 'mime_type': result['mime_type']}
1616
response = ai.prompt("What's in this image?", media_ids=[media_id], attachment_metadata=metadata)
1717
print(response["message"])
1818

19-
# 3. Generate Similar Images
20-
response = ai.prompt("Create similar in anime style", media_ids=[media_id], attachment_metadata=metadata, is_image_generation=True)
19+
# 3. Generate Similar Images with orientation
20+
response = ai.prompt(
21+
"Create similar in anime style",
22+
media_ids=[media_id],
23+
attachment_metadata=metadata,
24+
orientation="VERTICAL" # Options: "LANDSCAPE", "VERTICAL" (default), "SQUARE"
25+
)
2126
for img in response["media"]:
2227
print(img["url"])
2328

24-
# 4. Generate Video
25-
video = ai.generate_video("animate with cinematic motion", media_ids=[media_id], attachment_metadata=metadata)
29+
# 4. Generate Video with orientation
30+
video = ai.generate_video(
31+
"animate with cinematic motion",
32+
media_ids=[media_id],
33+
attachment_metadata=metadata,
34+
orientation="LANDSCAPE" # Wide format for cinematic effect
35+
)
2636
print(video["video_urls"][0])
2737
```
2838

README.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,22 +447,29 @@ print(f"\n🎉 Generated {len(videos)} videos successfully!")
447447
🎉 Generated 3 videos successfully!
448448
```
449449

450-
### Example 3: Advanced Video Generation
450+
### Example 3: Advanced Video Generation with Orientation
451451

452452
```python
453453
from metaai_api import MetaAI
454454

455455
ai = MetaAI(cookies=cookies)
456456

457-
# Fine-tune generation parameters
457+
# Generate video with specific orientation (default is VERTICAL)
458458
result = ai.generate_video(
459459
prompt="A time-lapse of a flower blooming",
460+
orientation="VERTICAL", # Options: "LANDSCAPE", "VERTICAL", "SQUARE"
460461
wait_before_poll=15, # Wait 15 seconds before checking
461462
max_attempts=50, # Try up to 50 times
462463
wait_seconds=3, # Wait 3 seconds between attempts
463464
verbose=True # Show detailed progress
464465
)
465466

467+
# Generate landscape video for widescreen
468+
result_landscape = ai.generate_video(
469+
prompt="Panoramic view of sunset over mountains",
470+
orientation="LANDSCAPE" # Wide format (16:9)
471+
)
472+
466473
if result["success"]:
467474
print(f"\n🎬 Your videos are ready!")
468475
print(f"🔗 Generated {len(result['video_urls'])} videos:")
@@ -471,6 +478,14 @@ if result["success"]:
471478
print(f"⏱️ Generated at: {result['timestamp']}")
472479
```
473480

481+
**Supported Video Orientations:**
482+
483+
- `"LANDSCAPE"` - Wide/horizontal (16:9) - ideal for widescreen, cinematic content
484+
- `"VERTICAL"` - Tall/vertical (9:16) - ideal for mobile, stories, reels (default)
485+
- `"SQUARE"` - Equal dimensions (1:1) - ideal for social posts
486+
487+
````
488+
474489
📖 **Full Video Guide:** See [VIDEO_GENERATION_README.md](https://github.com/mir-ashiq/metaai-api/blob/main/VIDEO_GENERATION_README.md) for complete documentation!
475490
476491
---
@@ -525,7 +540,7 @@ if result["success"]:
525540
)
526541
if video["success"]:
527542
print(f"🎬 Video: {video['video_urls'][0]}")
528-
```
543+
````
529544

530545
**Output:**
531546

@@ -543,24 +558,46 @@ if result["success"]:
543558

544559
## 🎨 Image Generation
545560

546-
Generate AI-powered images (requires Facebook authentication):
561+
Generate AI-powered images with customizable orientations (requires Facebook authentication):
547562

548563
```python
549564
from metaai_api import MetaAI
550565

551566
# Initialize with Facebook credentials
552567
ai = MetaAI(fb_email="your_email@example.com", fb_password="your_password")
553568

554-
# Generate images
569+
# Generate images with default orientation (VERTICAL)
555570
response = ai.prompt("Generate an image of a cyberpunk cityscape at night with neon lights")
556571

572+
# Or specify orientation explicitly
573+
response_landscape = ai.prompt(
574+
"Generate an image of a panoramic mountain landscape",
575+
orientation="LANDSCAPE" # Options: "LANDSCAPE", "VERTICAL", "SQUARE"
576+
)
577+
578+
response_vertical = ai.prompt(
579+
"Generate an image of a tall waterfall",
580+
orientation="VERTICAL" # Tall/portrait format (default)
581+
)
582+
583+
response_square = ai.prompt(
584+
"Generate an image of a centered mandala pattern",
585+
orientation="SQUARE" # Square format (1:1)
586+
)
587+
557588
# Display results (Meta AI generates 4 images by default)
558589
print(f"🎨 Generated {len(response['media'])} images:")
559590
for i, image in enumerate(response['media'], 1):
560591
print(f" Image {i}: {image['url']}")
561592
print(f" Prompt: {image['prompt']}")
562593
```
563594

595+
**Supported Orientations:**
596+
597+
- `"LANDSCAPE"` - Wide/horizontal format (16:9) - ideal for panoramas, landscapes
598+
- `"VERTICAL"` - Tall/vertical format (9:16) - ideal for portraits, mobile content (default)
599+
- `"SQUARE"` - Equal dimensions (1:1) - ideal for social media, profile images
600+
564601
**Output:**
565602

566603
```
@@ -640,7 +677,6 @@ class MetaAI:
640677
**Methods:**
641678

642679
- **`prompt(message, stream=False, new_conversation=False)`**
643-
644680
- Send a chat message
645681
- Returns: `dict` with `message`, `sources`, and `media`
646682

0 commit comments

Comments
 (0)