I found out:
You have to save the image for yourself:
$image2 has two significant elements:
$image2->source which is the filename of the original image and
$image2->resource which is the file resource, that is the PHP image resource. This resource is altered in the process, but not saved to disk.
imagejpeg ($image2->resource, $images2->source); will save the file as JPG under the same name.