hardcrop images in gutenberg “latest posts” block

The Latest Posts block uses (wp.data.select( 'core/block-editor' ).getSettings() to get) the image sizes in the editor settings which can be filtered via the block_editor_settings hook in PHP:

apply_filters( 'block_editor_settings', array $editor_settings, WP_Post $post )

Filters the settings to pass to the block editor.

And the setting name used for the image sizes is imageSizes.

So for example, to make the custom banner-image size be available in the featured image size dropdown (in the Latest Posts block’s settings):

add_filter( 'block_editor_settings', 'wpse_375600' );
function wpse_375600( $editor_settings ) {
    $editor_settings['imageSizes'][] = [
        'slug' => 'banner-image',
        'name' => 'Banner Image',
    ];

    return $editor_settings;
}

And in addition to that the filter being specific to the block editor, your callback can also get access to the post being edited, which is the second parameter ($post) in the filter hook as you can see above. So you could for example filter the settings only for certain posts.

Resources: