Resize media image stream in Sitecore

When working with MediaItems in Sitecore you might want to direct access to a stream behind the media item. On the a Sitecore.Data.Items.MediaItem you can call GetMediaStream() to accomplish that. It will return a stream to the raw data which might not be ideal if you are working with images. Often you would want a resized image, and fortunately you can use the Sitecore.Resources.Media.ResizeProcessor pipeline processor.