عرض الفئات

AI Image Generator – Create Images in Scratch

🎨 AI Image Generator – Create Images in Scratch #

The AI Image Generator extension brings powerful AI image creation directly into Scratch.
Create custom sprites and backdrops using simple text descriptions with:

    • OpenAI
    • Google Gemini
    • Stability AI

No drawing skills required ✨


🌟 Overview #

  • Text to Image: Describe what you want and AI creates it instantly.
  • Multiple AI Engines: OpenAI, Google Gemini, Stability AI.
  • 13 Art Styles: Cartoon, pixel, 3D, watercolor, anime, fantasy, and more.
  • Sprites and Backdrops: Generate costumes or full stage backgrounds.
  • Type Guidance: Pick costume type (character/object) or backdrop type (outdoor/indoor/abstract/space/underwater) to steer results.
  • Background Control: Automatically keep or remove costume backgrounds.
  • Child-Safe: Built-in content moderation for kids.
  • Flexible Pricing: Use free tiers, free credits, or paid usage depending on the engine.

✨ Key Features #

  • Supports OpenAI DALL·E, Google Gemini/Imagen, and Stability AI image models.
  • Tailored default models are included; use update model list to discover additional or newer ones.
  • 13 predefined art styles optimized for Scratch projects.
  • Costume and backdrop type presets to guide prompts (character/object, outdoor/indoor/abstract/space/underwater).
  • Smart background removal for transparent sprite costumes.
  • Automatic image resizing for sprites and stage backdrops.
  • Sequential naming (ai-costume1, ai-backdrop1, …).
  • Built-in safety moderation for kid-friendly prompts.
  • Prompt quality boosters for better results.
  • Separate API keys per engine.

 


🚀 How to Use #

  1. Go to: pishi.ai/play
  2. Open the Extensions panel.
  3. Select: مولّد الصور بالذكاء الاصطناعي
  4. Get an API key from one of the supported platforms:

Option 1: OpenAI (DALL·E)

  • OpenAI API Keys
  • Create a new API key (sk-proj-…).
  • Billing information may be required.

 

Option 2: Google Gemini

  • Google AI Studio
  • Create an API key with your Google account (AIza…).
  • Free tier available in many regions.

Tip: Free tier for image generation API access requires setting up Cloud Billing (which grants free usage credits).

 

Option 3: Stability AI (Recommended for Free Credits)

  • Stability AI API Keys
  • Create a free account.
  • 🎁 New accounts receive free image generation credits.
  • Generate an API key (sk-…) and start immediately.

 

set api key for [ENGINE]

Paste your key and start generating images.

 


🧱 Blocks and Functions #

 

🪄 Generate Sprite Costume #

generate costume of [PROMPT|text] using [MODEL]

Generates an AI image and adds it as a new sprite costume.
The image is resized for Scratch sprites and can optionally have a transparent background.

  • PROMPT: Text description of what you want to generate (e.g. “cute robot”, “pixel spaceship”).
  • MODEL: The AI image engine and model to use. For example:
    [openai] dall-e-2, [gemini] gemini-2.5-flash-image, [stability] stable-image-core.
  • To remove or keep backgrounds for future costume generations use: after costume generation [BG_MODE] the background
  • The costume is added to the sprite that was selected when the block started.
  • If no valid sprite exists, a new sprite is created automatically.
  • The new costume is selected immediately.

Example:

generate costume of [Friendly dragon with small wings|text] using [{openai} dall-e-3]

 

Friendly dragon with small wings - Sprite

 


🧩 Costume Type #

set costume type to [COSTUME_TYPE]

Sets the type of sprite costumes.

  • COSTUME_TYPE: character or object
  • Use character for characters (usually full-body) centered in frame.
  • Use object for items or props with clean, isolated framing.

Tip: This setting stays active until you change it.

Example:

set costume type to [object]
generate costume of [Hercule Poirot Mustache|text] using [{openai} dall-e-2]

 

 


✂️ Background Removal (Costumes) #

after costume generation [BG_MODE] the background

Controls background removal for future costume generations.

  • BG_MODE: remove (to make backgrounds transparent), keep (to keep backgrounds).

Tip: This setting only affects costumes, not backdrops.


🌄 Generate Backdrop #

generate backdrop of [PROMPT|text] using [MODEL]

Generates an AI image and adds it as a new stage backdrop.
The image is resized to fit the Scratch stage.

  • PROMPT: Description of the scene or environment.
  • MODEL: The AI image engine and model to use.
  • Backdrops are resized to 480×360.
  • The background is always kept.
  • To guide the scene style use: set backdrop type to [BACKDROP_TYPE]

Example:

generate backdrop of [A Room in Pink Theme|text] using [{gemini} gemini-2.5-flash-image]

 

A room in Pink Theme Backdrop

 


🏷️ Backdrop Type #

set backdrop type to [BACKDROP_TYPE]

Sets the scene category used when generating backdrops.

  • BACKDROP_TYPE: outdoor, indoor, abstract, space, or underwater.

Tip: This setting stays active until you change it.

Example:

set backdrop type to [indoor]
generate backdrop of [A Place in Green Theme and Pixel style|text] using [{gemini} gemini-2.5-flash-image]
generate costume of [A Smiling Robot in Pixel style|text] using [{stability} stable-diffusion-xl-1024-v1-0]

 

a cute smiling robot in a green indoor room in pixel style

 


🎭 Style Customization #

set image style to [STYLE]

Sets the visual art style used for all future image generations.

  • STYLE: One of the predefined art styles.
  • cartoon, simple, pixel, 3d, watercolor, sketch
  • comic, anime, origami, clay, voxel, sticker, fantasy

Tip: The selected style remains active until you change it.

Example:

set image style to [origami]
generate backdrop of [An Empty Sunny Beach|text] using [{gemini} gemini-3-pro-image-preview]
generate costume of [A Funny Frog with its Tongue out|text] using [{stability} stable-image-core ]

 

A funny frog with tongue out Sprite in a beach Backdrop all in Origami Style

 


🔑 API Key Management #

set api key for [ENGINE]

Stores an API key for the selected AI engine.

  • ENGINE: Choose one of: openai, gemini, stability.
  • Each engine’s key is stored separately.
  • Keys are saved only in the current browser session.
  • Keys are cleared when the tab is closed.

Tip: Stability AI is a good starting choice because it offers free credits on signup.


🤖 Model Management #

update [ENGINE] model list

Fetches the latest available image models from the selected platform.

  • ENGINE: The AI platform to update models for.
  • Requires a valid API key.
  • Calling this can add new models to the menu, including newly published models and aliases or earlier versions of default models.
  • Example: nano-banana-pro-preview which is actually a preview/alias for gemini-3-pro-image-preview.

Default model list (before updates):

  • OpenAI: dall-e-3, dall-e-2
  • Google Gemini: gemini-2.5-flash-image, gemini-3-pro-image-preview, imagen-4.0-generate-001, imagen-4.0-fast-generate-001
  • Stability AI: stable-diffusion-xl-1024-v1-0, stable-image-core

📊 Status and Errors #

last generated [ASSET_TYPE] name

Returns the name of the most recently generated asset.

  • ASSET_TYPE: costume or backdrop
last image generator error

Returns the last image generation error message, or empty if successful.

  • Useful for debugging and showing friendly messages to users.

🎓 Educational Uses #

  • Understand how AI generates images:
    Students explore the process of turning text into visuals and learn how modern multimodal models work.
  • Practice comparing AI engines and art styles:
    Try different models (OpenAI, Stability, etc.) and see how each one creates unique results, even from the same prompt.
  • Create game assets instantly:
    Make characters, backgrounds, props, and icons without needing drawing skills, making Scratch-style projects more accessible.
  • Learn prompt engineering through experimentation:
    Students see how wording affects the final image and discover techniques for clarity, style control, and creativity.
  • Enhance storytelling and animation projects:
    Quickly generate scenes and characters for interactive stories, comics, and animations.
  • Practice safe and responsible AI usage:
    Discuss why some prompts are restricted, how moderation protects users, and why ethical AI matters in creative tools.
  • Encourage personal creativity and ownership:
    Students can generate custom designs that match their own ideas, making learning more engaging and expressive.
  • Support teachers in producing visual materials:
    Educators can generate diagrams, teaching aids, and simple illustrations directly inside pishi.ai projects.

🔧 Tips and Troubleshooting #

 

🧠 Choosing the Right Engine #

Which engine is best depends on your priorities: image quality, speed, cost, or control. Below is a concise comparison to help pick the right one for a classroom or project.

  • Best overall fidelity and understanding: OpenAI DALL·E 3
  • Fastest iterations & strong image quality: Google Gemini (Flash / fast Imagen variants)
  • Most customization & artistic control: Stability AI (SDXL / stable-image-core / SD3)
  • Best free starting credits: Stability AI (free credits on signup)

Quick selection tips: For classroom use start with Stability to save costs and experiment. For final high-quality assets use DALL·E 3. For very fast feedback loops (sketches, thumbnails) try Gemini Flash or the faster Imagen variants.

 

Notes:

  • Use simple styles for cleaner background removal.
  • Be specific in prompts for better results.
  • Generate multiple costumes to animate sprites.
  • Monitor usage to avoid unexpected costs.

🔒 Privacy and Safety #

  • Internet connection required for image generation.
  • Prompts are checked for kid-safe content.
  • Images are stored locally in your Scratch project.
  • Never share API keys publicly.
  • Always supervise children when using AI tools.

💰 Costs and Usage #

OpenAI: Paid per image
Google Gemini: Free tier (requires setting up Cloud Billing) + paid options
Stability AI: Free credits on signup + credit-based pricing

  • Use free tiers and credits for education.
  • Start with cheaper models for testing.
  • Write clear prompts to avoid regenerations.

🔗 Related Extensions #

  • 💬 ChatGPT – generate better prompts
  • 🎤 Speech Recognition – speak prompts
  • 🖊️ Text to Speech – narrate images
  • 📝 Translate – multilingual prompts

📚 Learn More #


Scroll to Top