Re: Viewing a UIImageJPEGRepresentation image on the desktop
Re: Viewing a UIImageJPEGRepresentation image on the desktop
- Subject: Re: Viewing a UIImageJPEGRepresentation image on the desktop
- From: Randall Meadows <email@hidden>
- Date: Fri, 23 Oct 2009 10:47:29 -0600
On Oct 22, 2009, at 3:38 PM, The Grand Poohbah wrote:
I need to examine an image that was stored in a property list as a
NSData UIImageJPEGRepresentation. The property list is a plist file
that is sent to me from an iPhone as an email attachment. The image
is a "Data" class item in the property list and stored as a long
series of hex bytes. I could view the image on an iPhone because
that's how the image was created in the first place (I wrote it),
but I'd much rather view it directly on my OS X Mac hardware.
Is there a way in OS X to view an image that was stored as a NSData
UIImageJPEGRepresentation?
What I do often when debugging image issues is, stop in the debugger
once I have a handle to the image data (in an NSData object), and make
this call in the GDB console (assume imgData is the NSData object
containing the JPEG image data):
call (BOOL)[imgData writeToFile:@"/Users/randy/Desktop/image.jpg"
atomically:NO]
The result (1 or 0) will be printed out, and if 1 the image file can
be found on your Desktop.
I've also skipped the NSData object completely, when all I have in my
code is a UIImage object:
call (BOOL)[(NSData *)UIImagePNGRepresentation(myUiImage)
writeToFile:@"/Users/randy/Desktop/image.jpg" atomically:NO]
(Disclaimer: written in Mail.app, but it should be pretty darn close
to correct.)
--
randy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden