The Devil is in the Details: Example-based Image Restoration and Detail Synthesis