Search by

drupal / ai_recipe_image_crop

Drupal-Infrastructure

Adds AI-suggested focal points to Images using the AI Image Crop module.

Package info

git.drupalcode.org/project/ai_recipe_image_crop.git

Homepage

Type:drupal-recipe

pkg:composer/drupal/ai_recipe_image_crop

Statistics

Installs: 160

Dependents: 0

Suggesters: 0

1.0.0-alpha2 2026-09-16 22:48 UTC

This package is auto-updated.

Last update: 2026-09-16 22:52:18 UTC


README

Adds AI-suggested focal points to Images in the Media: Image bundle. Editors get a "Suggest AI Focal Point" button on the image field. Clicking it will leverage a vision-capable AI model to automatically place a focal point on the main subject. The result can still be adjusted by hand.

Requirements

Apply

  1. Set up a vision-capable provider before applying
  2. Install the recipe:
    composer require drupal/ai_recipe_image_crop
    
  3. Apply the recipe:
    drush recipe ../recipes/ai_recipe_image_crop
    drush cache:rebuild
    

What it does

  • Applies core's image_media_type recipe for the Media: Image bundle
  • Installs ai, ai_image_crop, field_widget_actions, and focal_point, and imports their configuration (the AI preview image style, prompts and the focal_point crop type)
  • Switches the field_media_image widget on the Image media type's default and media_library form displays to Focal Point
  • Adds the AI Focal Point button to that widget as a Field Widget Action

The button is configured per form display, so it can be renamed, given a custom prompt, allowed to replace existing focal points, or switched to run automatically on form load, at Manage form display > widget settings > Field Widget Actions.

The widget type and its settings are set individually (with the setProperties config action) rather than replacing the whole component, so the field's weight and any third-party settings already on it are kept, for example the alt text button that ai_recipe_image_alt_text adds. Only the image widget's own settings are replaced, since they have to match the Focal Point widget.

Issue queue

Bugs and feature requests: https://www.drupal.org/project/issues/ai_recipe_image_crop