I’ve had some requests to add basic “Save” functionality to my WPF Photo Print utility. It’s exceptionally quirky, but it gets the job done
A few notes…
- Like the print functionality, it’ll only let you save images that are checked. If you use the File –> Save as option, it’ll save the currently selected and checked file. If you use the Save and Export –> Save option, it’ll save all checked images.
- Files aren’t saved with the name you tell it to use
Since it can save a batch of files, it gives each one a name based on the name you specify combined with the original name. So if your original is called Original.jpg and you save the edited image as MyNew.jpg, the result will be MyNew_Original.jpg. Totally weird but I didn’t want to give it too much thought just yet. - It scales saved images to fit an [arbitrarily sized] 3000 x 3000 box, retaining the required aspect ratio. This could be improved (so it could figure out an appropriate size based on the original size and transforms you applied), but I decided to leave that as a later exercise.
- It requires .NET 4.0 or above (if using ClickOnce link, it might install that for you if needed).
The ClickOnce app is available here, and the source is on CodePlex as usual.



5 comments
Comments feed for this article
September 7, 2010 at 10:08 am
Faye
Hi Chris,
I am not able to run the code because it is saying the clicone manifest cannot be imported. The key file may be password protected.I went to signing and tried to select the key file again but it prompted for a password? How can I go about getting the key to import properly?
thanks,
Faye
September 7, 2010 at 10:52 am
Chris Cavanagh
Faye – Try going to the main app project settings and on the Signing tab, uncheck “Sign the ClickOnce manifests”. You only need that stuff if you’re deploying the app somewhere with ClickOnce; running locally you won’t need it. Let me know if this helps.
September 7, 2010 at 11:40 am
Faye
Perfect. That worked. Thank you.
September 7, 2010 at 12:00 pm
Faye
Hi Chris,
While playing around with the crop tool. I saw that if you crop once then hit the delete x that is errors out to fix it. I wrapped the crop towith a check to make sure the context.transformation was not null.
protected override Size ArrangeOverride(Size finalSize)
{
/* // desiredWidth and desiredHeight are the width and height of the element that’s being adorned.
// These will be used to place the ResizingAdorner at the corners of the adorned element.
double desiredWidth = AdornedElement.DesiredSize.Width;
double desiredHeight = AdornedElement.DesiredSize.Height;
// adornerWidth & adornerHeight are used for placement as well.
double adornerWidth = this.DesiredSize.Width;
double adornerHeight = this.DesiredSize.Height;
*/
var adornedElement = AdornedElement as FrameworkElement;
var context = adornedElement.DataContext as TransformationContext;
var crop = context.Transformation as Crop;
if (crop != null )
{
MoveThumb(topLeft, crop.Bounds.TopLeft);
MoveThumb(topRight, crop.Bounds.TopRight);
MoveThumb(bottomLeft, crop.Bounds.BottomLeft);
MoveThumb(bottomRight, crop.Bounds.BottomRight);
}
// Return the final size.
return finalSize;
}
Faye
September 7, 2010 at 2:36 pm
Chris Cavanagh
Faye – Thanks for finding/fixing that! I’ll get it updated on Codeplex