Advertise Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

sdkIQ for iPhone
($4.99)

Your First iPhone App
($1.99)

iPhone Code Generator
($9.99)

Dual Matches
($0.99)

Calcuccino Programmers' Calculator
($2.99)

SDKtoday
(free)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-06-2009, 10:36 AM   #1 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default Embedded Images for Wallpaper

Is it possible to include an image within an application that a user can then set as Wallpaper for their device?
DenVog is offline   Reply With Quote
Old 03-06-2009, 10:54 AM   #2 (permalink)
New Member
 
Join Date: Feb 2009
Location: Milwaukee, WI
Posts: 22
Default

Are you trying to update the Wallpaper from your app? I dont think this is possible. You can however, save an image to the Camera Roll and then have the user pick it for Wallpaper. Check out the App "If Found".
mattmcegg is offline   Reply With Quote
Old 03-06-2009, 07:55 PM   #3 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default

Quote:
Originally Posted by mattmcegg View Post
Are you trying to update the Wallpaper from your app? I dont think this is possible. You can however, save an image to the Camera Roll and then have the user pick it for Wallpaper. Check out the App "If Found".
Yes. I was hoping it was possible to allow the user to do it in one step. The closest I have seen is in the Watchmen App, which lets you pick a photo from a screen and "save" it to the photo library. You then obviously have to switch to the Photos App and select it from there to email, wallpaper, etc.
DenVog is offline   Reply With Quote
Old 03-06-2009, 09:00 PM   #4 (permalink)
Taking Baby Steps...
 
Join Date: Jan 2009
Location: Denver
Posts: 37
Default

Quote:
Originally Posted by DenVog View Post
Yes. I was hoping it was possible to allow the user to do it in one step.
Not within the SDK. You can generate an image, save it to the camera roll, but beyond that there's nothing you can do. I've filed an enhancement request with Apple for this functionality.
brandons is offline   Reply With Quote
Old 03-07-2009, 11:03 AM   #5 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default

Quote:
Originally Posted by brandons View Post
Not within the SDK. You can generate an image, save it to the camera roll, but beyond that there's nothing you can do. I've filed an enhancement request with Apple for this functionality.
Thanks for this info. Saves me banging my head against the wall trying to do something that's not possible.
DenVog is offline   Reply With Quote
Old 03-08-2009, 01:17 PM   #6 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default

I am curious how they are saving the image. Are they able to save the file directly from the application? I am guessing so, since there is a "save" button on top of the image in the application but it doesn't show up in the graphic that ends up in the Camera Roll. I have not seen how to save directly, but if they were saving the View, that "save" button would show up as well and the image quality would be second generation. Right?
DenVog is offline   Reply With Quote
Old 03-08-2009, 01:26 PM   #7 (permalink)
Taking Baby Steps...
 
Join Date: Jan 2009
Location: Denver
Posts: 37
Default

Quote:
Originally Posted by DenVog View Post
I am curious how they are saving the image. Are they able to save the file directly from the application? I am guessing so, since there is a "save" button on top of the image in the application but it doesn't show up in the graphic that ends up in the Camera Roll. I have not seen how to save directly, but if they were saving the View, that "save" button would show up as well and the image quality would be second generation. Right?
I'm doing this in my app - maybe not the best way to do it, but you get the idea:

Code:
[appDelegate.rootViewController.view bringSubviewToFront:appDelegate.rootViewController.imageViewController.view];
CGSize size = CGSizeMake(320.0,480.0);
	UIGraphicsBeginImageContext(size);
	[appDelegate.rootViewController.imageViewController.view.superview.layer renderInContext:UIGraphicsGetCurrentContext()];
	imageSave = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
Then you want to check out - UIImageWriteToSavedPhotosAlbum

PS - if anyone can tell me how I would get to that layer in less steps I would appreciate it

Last edited by brandons; 03-08-2009 at 01:31 PM.
brandons is offline   Reply With Quote
Old 03-08-2009, 01:30 PM   #8 (permalink)
New Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
Default

To save an image to the camera roll you use the function UIImageWriteToSavedPhotosAlbum.
RickMaddy is offline   Reply With Quote
Old 03-09-2009, 07:14 PM   #9 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default

Quote:
Originally Posted by brandons View Post
I'm doing this in my app - maybe not the best way to do it, but you get the idea:
Thanks for sharing this brandons. Am I correct in understanding that you're opening a view that you've populated with an image in Interface Builder, then saving that view? Does this result in saving a second generation image that will be lower quality than the original (e.g. if you told it to save a file from your bundle based on a path name)?
DenVog is offline   Reply With Quote
Old 03-09-2009, 07:25 PM   #10 (permalink)
Taking Baby Steps...
 
Join Date: Jan 2009
Location: Denver
Posts: 37
Default

Long story short - there's no Interface builder involved but I'm basically using a scrollview with an imageview in it to allow for manipulation of the image by the user. When they hit the save button I grab that layer, dump it into another imageview and put some labels on it. That is then saved as the final image.

I'm going to re-work this process because its convoluted right now, but it works fine for right now.

To answer your specific question though ... Yes, this would be second generation since its not using the original image data but creating a whole new image from the view. However, if there's any image degradation its minimal from what I can see and for my purposes its not really an issue.

I can't say I'd do the same thing if I was planning on creating works of art =)
__________________
Still learning!

My first app - gCalWall (also now in Lite!)
brandons is offline   Reply With Quote
Old 03-09-2009, 07:53 PM   #11 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default

Quote:
Originally Posted by brandons View Post
Yes, this would be second generation since its not using the original image data but creating a whole new image from the view.
Thanks for the clarification brandons. I'm not using any works of art, but just wanted to make sure I understood what is happening.

What I might do, if I can figure it out, is show a preview of the image on the screen in a view but then tell the button to save the original file. It's not so much that the quality has to be great, but I will have a "save" button on the screen and I don't want it included as part of the image.

I thought the follow would get it, but does not.
Code:
- (IBAction)save:(id)sender {
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"]];
UIImageWriteToSavedPhotosAlbum(UIGraphicsGetImageFromCurrentImageContext(), nil, nil, nil);
UIGraphicsEndImageContext();	
}
DenVog is offline   Reply With Quote
Old 03-09-2009, 09:17 PM   #12 (permalink)
New Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
Default

If all you want to do is save an image from your resource bundle to the camera roll then change your code to this:

Code:
- (IBAction)save:(id)sender {
    UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"]];
    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
RickMaddy is offline   Reply With Quote
Old 03-09-2009, 10:25 PM   #13 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 582
Default

Quote:
Originally Posted by RickMaddy View Post
If all you want to do is save an image from your resource bundle to the camera roll then change your code to this:

Code:
- (IBAction)save:(id)sender {
    UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"]];
    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
Sweet! Thanks Rick. That's exactly what I needed.
DenVog is offline   Reply With Quote
Old 11-11-2009, 12:58 PM   #14 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 12
Default help please!

Quote:
Originally Posted by RickMaddy View Post
If all you want to do is save an image from your resource bundle to the camera roll then change your code to this:

Code:
- (IBAction)save:(id)sender {
    UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"]];
    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
This works if I put in @"image0". Just "image" shows black. How do I add the other 24 images? Thanks!

robart.
robart is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


» Advertisements
» Stats
Members: 41,861
Threads: 49,770
Posts: 213,057
Top Poster: BrianSlick (3,139)
Welcome to our newest member, melodizzzy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:01 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0