Appearance
Edit Images and Rebuild Thumbnails with AI
Easy MCP AI lets your connected AI client crop or resize images already in your WordPress Media Library and rebuild missing thumbnails. Thumbnails are the smaller image sizes WordPress uses in different parts of your site.
If your image is not in WordPress yet, follow Uploading AI-Generated Images to WordPress first.
Crop or Resize an Image
Use wp_edit_media_image to crop or resize a Media Library image. Cropping keeps a selected area of an image; resizing changes its dimensions.
- In your connected AI client, identify the image you want to edit by its title or attachment ID, the number WordPress uses to identify a Media Library item.
- Tell the AI whether you want to crop or resize it. For a crop, describe the area to keep and the dimensions you need. For a resize, specify the target width and height in pixels.
- Ask the AI to carry out the edit using
wp_edit_media_image.
For example:
text
Find the Media Library image titled "Homepage banner" and use
wp_edit_media_image to crop it to a centered 1200 × 600 pixel image.For resizing instead:
text
Use wp_edit_media_image to resize attachment 123 to 800 × 600 pixels.Replace the example title or attachment ID and dimensions with your own.
Rebuild Missing Thumbnails
Use wp_regenerate_media_sizes to rebuild missing thumbnail sizes for attachments already in your Media Library. This is a different task from cropping or resizing an image: it generates missing image sizes rather than asking for a new crop or custom dimensions.
In your connected AI client, identify the attachment and ask the AI to rebuild its missing thumbnails:
text
Use wp_regenerate_media_sizes to rebuild missing thumbnail sizes
for attachment 123.Replace 123 with the attachment ID of your image.