Skip to content

Instantly share code, notes, and snippets.

@eldewall
Last active December 10, 2015 22:18
Show Gist options
  • Save eldewall/4501725 to your computer and use it in GitHub Desktop.
Save eldewall/4501725 to your computer and use it in GitHub Desktop.
public ImageCreationResult Create() {
double load, resize, rotate, create, sharpen;
byte[] imageBytes = null;
using (Bitmap source = ActionTimer.Time(() => { return Load(); }, out load)) {
using (Bitmap resized = ActionTimer.Time(() => { return Resize(source); }, out resize)) {
ActionTimer.Time(() => { Rotate(resized); }, out rotate);
ActionTimer.Time(() => { Sharpen(resized); }, out sharpen);
ActionTimer.Time(() => {
imageBytes = ImageTools.CreateJpeg(resized, Spec.Quality);
}, out create);
}
}
Timings t = new Timings(load, resize, rotate, create, sharpen);
return new ImageCreationResult(imageBytes, t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment