drupal / ai_recipe_image_crop
Adds AI-suggested focal points to Images using the AI Image Crop module.
Package info
git.drupalcode.org/project/ai_recipe_image_crop.git
Type:drupal-recipe
pkg:composer/drupal/ai_recipe_image_crop
Requires
- drupal/ai: ^1.4
- drupal/ai_image_crop: ^1.0.0-alpha4@alpha
- drupal/core: ^11.2
- drupal/field_widget_actions: ^1.4
- drupal/focal_point: ^2.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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
- Drupal 11.2+ (for the
setPropertiesconfig action) - AI Module
- AI Image Crop 1.0.0-alpha4 or later
- Field Widget Actions
- Focal Point
- Configured default AI Vision provider (OpenAI GPT-4o/GPT-5, Anthropic Claude, Google Gemini, etc.) at
/admin/config/ai/settings
Apply
- Set up a vision-capable provider before applying
- Install the recipe:
composer require drupal/ai_recipe_image_crop - Apply the recipe:
drush recipe ../recipes/ai_recipe_image_crop drush cache:rebuild
What it does
- Applies core's
image_media_typerecipe for the Media: Image bundle - Installs
ai,ai_image_crop,field_widget_actions, andfocal_point, and imports their configuration (the AI preview image style, prompts and thefocal_pointcrop type) - Switches the
field_media_imagewidget on the Image media type'sdefaultandmedia_libraryform 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