Hi @Matthias
The get_sub_field does not have an option for formatting.
You will need to construct the $ids like so:
<?php
$images = get_sub_field('gallery');
$image_ids = array();
foreach( $images as $image )
{
$image_ids[] = $image['id'];
}
$shortcode = '[gallery ids="' . implode(',', $image_ids) . '"]';
echo do_shortcode( $shortcode );
?>