Time-resolved imaging using x-ray free electron lasers