0
votes

I am using CameraCaptureTask to take a picture and save the resulting image to the Photos Hub. I've noticed that even if I perform no action within the Completed event, a picture is always saved by default to the device's Camera Roll with a standard naming scheme. Is it possible to modify the name before saving? Note I do not want to also save another copy with a custom name via MediaLibrary and have duplicates. If not, is there another way to get the resulting image and save method that would accomplish this requirement?

2

2 Answers

0
votes

You cannot use CameraCaptureTask to save images with custom names. It saves the image to the CameraRoll as soon as the image is captured and available.

You can use PhotoCamera instead to handle all the required events.

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202956(v=vs.105).aspx

You can save the image to the CameraRoll folder on its CaptureImageAvailable event using MediaLibary's SavePictureToCameraRoll function. You can optionally save the picture to Saved Pictures folder using MediaLibrary's SavePicture function.

You can set flash, focus etc by overriding certain functions like ShutterKeyHalfPressed , ShutterKeyPressed, ShutterKeyReleased

So, ideally this class should do everything for you that CameraCaptureTask does.

0
votes

Quick and dirty answer, but can't you do something like this (i.e. rename the file when it comes back to you)?

void test()
{
    CameraCaptureTask tsk = new CameraCaptureTask();
    tsk.Completed += tsk_Completed;
    tsk.Show();
}

void tsk_Completed(object sender, PhotoResult e)
{
    var fn = e.OriginalFileName;
    File.Move(fn, "newName.jpg");
}

NOTE Untested