PHPackages                             basilicom/ai-image-generator-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. basilicom/ai-image-generator-bundle

ActivePimcore-bundle[Image &amp; Media](/categories/media)

basilicom/ai-image-generator-bundle
===================================

v0.9.0(2y ago)472GPL-3.0-or-laterPHPPHP ^8.0

Since Jul 14Pushed 2y ago9 watchersCompare

[ Source](https://github.com/basilicom/ai-image-generator-bundle)[ Packagist](https://packagist.org/packages/basilicom/ai-image-generator-bundle)[ RSS](/packages/basilicom-ai-image-generator-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (16)Used By (0)

AI Image Generator Bundle
=========================

[](#ai-image-generator-bundle)

This is bundle utalizes common APIs for generative image AIs to generate images in the Pimcore Backend.

Installation
------------

[](#installation)

```
composer update basilicom/ai-image-generator-bundle

```

Make sure to also install the bundle via `BundleSetupSubscriber` or console.

Support
-------

[](#support)

ParameterText-To-ImageVariationsUpscalingInpaintingBackground InpaintingClipDropXXX-XA1111XXXXXDreamStudioXXXX~OpenAIXX-XXConfiguration
-------------

[](#configuration)

```
ai_image_generator:
   brand:
    colors:
      - "#0062FF"
      - "#B34197"
      - "#FF444A"

  prompt_enhancement:
    service:        ~|ollama|basilicom|open_ai

    services:
      ollama:
        baseUrl:    "http://localhost:11434/"
        model:      "llama2"

      basilicom:
        baseUrl:    "http://localhost:8080/"

      open_ai:
        baseUrl:    "https://api.openai.com/v1"
        apiKey:     "%env(OPEN_AI_API_KEY)%"

  feature_services:
    txt2img:            open_ai | stable_diffusion_api | dream_studio | clip_drop
    image_variations:   open_ai | stable_diffusion_api | dream_studio | clip_drop
    upscale:            -       | stable_diffusion_api | dream_studio | clip_drop
    inpaint:            open_ai | stable_diffusion_api | dream_studio | -
    inpaint_background: open_ai | stable_diffusion_api | -            | clip_drop

  services:
    stable_diffusion_api:
      baseUrl:        "http://host.docker.internal:7860"
      model:          "JuggernautXL"
      inpaint_model:  "JuggernautXL"
      steps:          30
      upscaler:       "ESRGAN_4x"

    dream_studio:
      baseUrl:        "https://api.stability.ai"
      model:          "stable-diffusion-xl-beta-v2-2-2"
      inpaint_model:  "stable-diffusion-xl-1024-v1-0"
      steps:          10
      apiKey:         "%env(DREAM_STUDIO_API_KEY)%"
      upscaler:       "esrgan-v1-x2plus"

    open_ai:
      baseUrl:        "https://api.openai.com/v1"
      apiKey:         "%env(OPEN_AI_API_KEY)%"

    clip_drop:
      baseUrl:        "https://clipdrop-api.co"
      apiKey:         "%env(CLIP_DROP_API_KEY)%"

```

Usage
-----

[](#usage)

### Generating images in documents

[](#generating-images-in-documents)

If no prompt is given, the prompt will be generated (and not translated!) from

- document SEO title
- document SEO description
- h1-Elements
- h2-Elements
- h3- and h4-elements if the previous mentioned sources are empty

[![Image editables will get a button to generate an image](./docs/img/ai-image-in-documents.png)](./docs/img/ai-image-in-documents.png)

### Generating images in DataObjects

[](#generating-images-in-dataobjects)

If no prompt is given, the prompt will be generated (and not translated!) by trying to access the following properties:

- key
- title
- name
- productName
- description

[![Image and ImageGallery fields will get a context-menu-item to generate an image](./docs/img/ai-image-in-objects.png)](./docs/img/ai-image-in-objects.png)

API
---

[](#api)

#### `(POST) /admin/ai-images/generate/{context}-{id}`

[](#post-adminai-imagesgeneratecontext-id)

Generate an image based on a document or object context. If the prompt is empty, the budle-logic for prompting will take effect.

ParameterTypeExample**context**stringdocument/object**id**int123promptstringa towelaspectRatiostring16:9#### `(POST) /admin/ai-images/upscale/{id}`

[](#post-adminai-imagesupscaleid)

Upscale image, while the target upscaling size is AI-Service specific

ParameterTypeDefaultExample**id**int123#### `(POST) /admin/ai-images/vary/{id}`

[](#post-adminai-imagesvaryid)

Inpaint backgrounds where the background logic differ for provided AI-Services.

ParameterTypeDefaultExample**id**int123promptstringa towel### Responses

[](#responses)

Based on the `Accept`-header, you can say if you want to have a JSON-response or the image itself.

#### `Accept: application/json`

[](#accept-applicationjson)

```
{
  success: true,
  id: Pimcore-Asset-ID,
  image: "base64-decoded Image",
}

```

```
{
  success: false,
  message: "..."
}

```

#### `Accept: image/jpeg`

[](#accept-imagejpeg)

```
// the base64 decoded image

```

Using Stable Diffusion API
--------------------------

[](#using-stable-diffusion-api)

When running Automatic1111 locally, you can define `http://host.docker.internal:7860` as your local API-url.

Additionally, make sure you started Automatic1111 with `--api`:

```
  ./webui.sh --api # windows
  ./webui.bat --api # linux/mac

```

If you want to know which models you have, call the [Models-Endpoint](http://localhost:7860/sdapi/v1/sd-models) and copy the name of a model of your choice.

### Plugins used

[](#plugins-used)

- ControlNet with `canny` and `ip2p`
- *SD Upscaler* Post Processor Script

Using LLM-driven prompt enhancing
---------------------------------

[](#using-llm-driven-prompt-enhancing)

In order to enhance prompts, we use local images of LLMs. There are three supported prompt enhancement services:

- `open_ai` (ChatGPT)
- `basilicom` (a simple LLM implementation, see [Docker Hub](https://hub.docker.com/r/basilicom/llm-api))
- `ollama` (see [Github](https://hub.docker.com/r/ollama/ollama))

Limitations
-----------

[](#limitations)

- the DreamStudio REST API does currently not support variations, I'll look forward to use the gRPC API
- [ClipDrops text-to-image API can only create 1:1 images](https://clipdrop.co/apis/docs/text-to-image#text-to-image-api)

Additional ideas
----------------

[](#additional-ideas)

- Prompting
    - enhance prompts, especially for background inpainting, like ```
        background = "a creepy forest at night"
        image_type = "a haunted castle background"
        characters = "medieval warriors"
        action = "fighting for the honor"
        prompt = f"{image_type} in {background} with {characters} {action}"

        ```
- generate prompt in lightbox before sending?
- background-inpainting for other service by using masks
- CLIP interrogate in order to optimize variation prompting
    - allow variants by img2img and CLIP
- run IMG2IMG with low denoise on background-inpainting
- LCM for super fast preview generation =&gt; midjourney-like/inpainting-like image selection before upscaling, etc.
- outpainting via Thumbnail
- better error handling (warnings and fallbacks if credits exceeded)
- ComfyUI + Nodes to Python as fixed presets
    - allow docker images with presets
- InvokeAI

### Authors

[](#authors)

Alexander Heidrich

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Recently: every ~16 days

Total

15

Last Release

908d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/afb6145ee5c0c6af7662a537e76ee9c679d30e7e6217636d72576ea5ccd8b002?d=identicon)[AlexanderHeidrich](/maintainers/AlexanderHeidrich)

---

Top Contributors

[![AlexanderHeidrich](https://avatars.githubusercontent.com/u/9350895?v=4)](https://github.com/AlexanderHeidrich "AlexanderHeidrich (51 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/basilicom-ai-image-generator-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/basilicom-ai-image-generator-bundle/health.svg)](https://phpackages.com/packages/basilicom-ai-image-generator-bundle)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
