Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save a UIImage to a different name

I am writing an application which lets the user pick one photograph from a selection. Then I want to save that photograph to their photo roll to a specific name. i.e I always want the photo in the roll to be named the same thing and overwrite previous selections.

    UIImage* image = [UIImage imageNamed:[ImageNames objectAtIndex:self.miImage]];

    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);

I can't find anyway to make a copy of the image and assign a new name to it, or specify a target name for UIImageWriteToSavedPhotosAlbum().

Is there any way to do this?

thanks in advance,

Jay

like image 664
jbww Avatar asked Jan 21 '26 01:01

jbww


1 Answers

You cannot specify a filename when using UIImageWriteToSavedPhotosAlbum because it saves the image to the Camera Roll (or the Photos Library, if the device does not have a camera). This allows the system to assign it a name based on a format, like "DSC0001.jpg" or similar, and avoid name collisions.

Because of this, overwriting an image is also not possible, since the Photo Library / Camera Roll are controlled by the user - a user that would not appreciate a photo being overwritten by your application.

...writing the image to the user’s Camera Roll or Saved Photos album.

UIImageWriteToSavedPhotosAlbum Reference

like image 100
Evan Mulawski Avatar answered Jan 23 '26 15:01

Evan Mulawski