Saving and loading images (png) on the iPhone / iPad locally

Hi,
you might find this helpful..
Just tested how to save and load images, png in this case, locally on the i-Devices.
In addition with a SharedObject it could be used as an image cache.
Make sure you have the adobe.images.PNG encoder
https://github.com/mikechambers/as3corelib/blob/master/src/com/adobe/images/PNGEncoder.as
Not really tested, no error handling, just as a start.
Let me know, what you think...
Aaaaah and if somebody has any clue about this:
http://forums.adobe.com/thread/793584?tstart=0
would be great
Cheers Peter
    import flash.display.Bitmap
     import flash.display.BitmapData
    import flash.display.Loader   
    import flash.display.LoaderInfo
    import flash.events.*
    import flash.filesystem.File
    import flash.filesystem.FileMode
    import flash.filesystem.FileStream
    import flash.utils.ByteArray;
    import com.adobe.images.PNGEncoder;
private function savePic(){
    var bmp =  // Your Bitmap to save
    savePicToFile(bmp, "test.png")
private function loadPic(){
     readPicFromFile("test.png")
private function savePicToFile(bmp:Bitmap, fname:String){
       var ba:ByteArray = PNGEncoder.encode(bmp.bitmapData);
        var imagefile:File = File.applicationStorageDirectory;
        imagefile = imagefile.resolvePath(fname);
        var fileStream = new FileStream();
        fileStream.open(imagefile, FileMode.WRITE);
        fileStream.writeBytes(ba);
         trace("saved imagefile:"+imagefile.url)
private function readPicFromFile(fname:String){
        var imagefile:File = File.applicationStorageDirectory;
        imagefile = imagefile.resolvePath(fname);
        trace("read imagefile:"+imagefile.url)
        var ba:ByteArray = new ByteArray();
        var fileStream = new FileStream();
        fileStream.open(imagefile, FileMode.READ);
        fileStream.readBytes(ba);
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPicRead)
        loader.loadBytes(ba);   
private function onPicRead(e:Event){
    trace("onPicRead")
     var bmp:Bitmap = Bitmap(e.target.content)
     // Do something with it

Are the movies transferred to your iPhone via the iTunes sync/transfer process but don't play on your iPhone?
Copied from this link.
http://www.apple.com/iphone/specs.html
Video formats supported: H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats.
What are you using for the conversion? Does whatever you are using for the conversion include an iPod or iPhone compatible setting for the conversion?
iTunes includes a create iPod or iPhone version for a video in your iTunes library. Select the video and at the menu bar, go to Advanced and select Create iPod or iPhone version. This will duplicate the video in your iTunes library. Select this version for transfer to your iPhone to see if this makes any difference.

Similar Messages

  • Saving and Loading specific properties of an Image

    Hey everyone. I'm currently in the process of developing a game which allows you to customize the color (hue) of your character via a slider. What I would like to happen is: Upon clicking either Accept or Play, it will save the current hue of the image, navigating back to that page will load what was previously saved (hue), as well as when starting the game, it will replace the standard graphic with the previously saved image.
    Below is the code I have right now that pertains to the image with a basic non-functioning properly saving and loading code:
    import flash.events.KeyboardEvent;
    // open a local shared object called "myStuff", if there is no such object - create a new one
    var savedstuff:SharedObject = SharedObject.getLocal("myStuff");
    Accept.addEventListener(MouseEvent.CLICK, SaveData);
    PlayBTN.addEventListener(MouseEvent.CLICK, LoadData);
    function SaveData(MouseEvent){
               savedstuff.data.username = Sliders.Dino.MovieClip // changes var username in sharedobject
               savedstuff.flush(); // saves data on hard drive
    function LoadData(event: MouseEvent)
               if(savedstuff.size>0){ // checks if there is something saved
               Sliders.Dino.MovieClip = savedstuff.data.username} // change field text to username variable
    // if something was saved before, show it on start
    if(savedstuff.size>0){
    Sliders.Dino.MovieClip = savedstuff.data.username}
    What I have above is only saving the actual image, which is inside a movie clip names Sliders.
    Below is the Class I am using that associates with the slider that changes the hue of "Dino".
    package
              import flash.display.Sprite;
              import fl.motion.AdjustColor;
              import flash.filters.ColorMatrixFilter;
              import fl.events.SliderEvent;
              public class Main extends Sprite
                        private var color:AdjustColor = new AdjustColor();
                        private var filter:ColorMatrixFilter;
                        public function Main():void
                                  /* Required to create initial Matrix */
                                  color.brightness = 0;
                                  color.contrast = 0;
                                  color.hue = 0;
                                  color.saturation = 0;
                                  /* Add Listeners function */
                                  addListeners();
                        private final function addListeners():void
                                  colorPanel.hueSL.addEventListener(SliderEvent.CHANGE, adjustHue);
                        private final function adjustHue(e:SliderEvent):void
                                  color.hue = e.target.value;
                                  update();
                        private final function update():void
                                  filter = new ColorMatrixFilter(color.CalculateFinalFlatArray());
                                  Dino.filters = [filter];
    Overall what I'm asking for is: How do I get it to save the current hue of an image by clicking a button, and then having that previously saved image be loaded upon reloading or clicking a button? To me, it doesn't seem like it should be too hard, but for some reason I can not grasp it.
    Thanks in advance for reading this and for any assistance you have to offer!

    This is the Class that you told me to use:
    package
              import flash.display.Sprite;
              import fl.motion.AdjustColor;
              import flash.filters.ColorMatrixFilter;
              import fl.events.SliderEvent;
              import flash.net.SharedObject;
              public class Main extends Sprite
                        private var color:AdjustColor = new AdjustColor();
                        private var filter:ColorMatrixFilter;
                        private var so:SharedObject;
                        public function Main():void
                                  color.brightness = 0;
                                  color.contrast = 0;
                                  color.saturation = 0;
                                  so = SharedObject.getLocal("myStuff");
                                  if (so.data.hue)
                                            color.hue = so.data.hue;
                                  else
                                            color.hue = 0;
                                  update();
                                  addListeners();
                        private final function addListeners():void
                                  colorPanel.hueSL.addEventListener(SliderEvent.CHANGE, adjustHue);
                        private final function adjustHue(e:SliderEvent):void
                                  color.hue = e.target.value;
                                  so.data.hue = color.hue;
                                  so.flush();
                                  update();
                        private final function update():void
                                  filter = new ColorMatrixFilter(color.CalculateFinalFlatArray());
                                  Dino.filters = [filter];
    And this is the FLA Code:
    import flash.events.KeyboardEvent;
    // open a local shared object called "myStuff", if there is no such object - create a new one
    var savedstuff:SharedObject = SharedObject.getLocal("myStuff");
    Accept.addEventListener(MouseEvent.CLICK, SaveData);
    PlayBTN.addEventListener(MouseEvent.CLICK, LoadData);
    function SaveData(MouseEvent)
              savedstuff.data.username = Sliders.Dino.MovieClip;// changes var username in sharedobject
              savedstuff.flush();
              // saves data on hard drive;
    function LoadData(event: MouseEvent)
              if (savedstuff.size > 0)
              {// checks if there is something saved
                        Sliders.Dino.MovieClip = savedstuff.data.username;
              }// change field text to username variable
    // if something was saved before, show it on start
    if (savedstuff.size > 0)
              Sliders.Dino.MovieClip = savedstuff.data.username;

  • I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    Hey kristiac,
    Thanks for the question. If I understand correctly, you have no service on the iPhone. I would recommend that you read this article, it may be able to help the issue.
    If you can't connect to a cellular network or cellular data - Apple Support
    Thanks for using Apple Support Communities.
    Have a good one,
    Mario

  • I can't find photos imported from my iPhone 4 with "Image Capture" to iPhoto in my iPhoto anywhere... and they were deleted from the iPhone after import! Can anyone help me find the photos?

    I can't find photos imported from my iPhone 4 with "Image Capture" to iPhoto anywhere... and they were deleted from the iPhone after import! Can anyone help me find the photos?

    Do you know the date they were taken? Try search on that.
    Regards
    TD

  • How do I transfer all photos and music from my old iphone 3gs to new iphone 4s? I have a new laptop because the old one broke and so do not have non camera roll photos or music stored anywhere apart from the iphone 3gs and cannot update io5 on the iphone

    How do I transfer all photos and music from my old iphone 3gs to new iphone 4s? I have a new laptop because the old one broke and so do not have non camera roll photos or music stored anywhere apart from the iphone 3gs and cannot update io5 on the iphone 3gs without erasibng everything. i need help!!!

    Syncing to a new iTunes library or computer will erase your phone. Only if you back up manually before syncing, you can restore your device from that backup again. A manual backup does not include the sync process.
    Do this:
    Disable autosync in iTunes, connect your phone to your new computer and right click on it in the device list and choose backup. iTunes will backup your device without syncing.
    Transfer your purchases the same way, choosing "transfer purchases" this time.
    When you connect your phone for the first time, all media content will be erased. But you can restore your settings and app data from your manual backup afterwards.
    Don't forget to set up at least one contact and event on your new computer to be able to merge calendars and contacts when you sync the iPhone for the first time.
    Music is one way only, from the computer to your device, unless you bought the songs in itunes and transferred your purchases.
    There is 3rd party software out there, but not supported by Apple, see this thread: http://discussions.apple.com/thread.jspa?threadID=2013615&tstart=0
    About backups and what's saved:iTunes: About iOS backups
    How to back up and restore:http://support.apple.com/kb/HT1414
    How to download apps for free again:http://support.apple.com/kb/HT2519
    Saving other data is also described here. How to back up your data and set up as a new device

  • Whit the new iTunes how i can down load my pictures from the iPhone to the computer  to make more spaces

    whit the new iTunes how i can down load my pictures from the iPhone to the computer  to make more spaces

    Hi shadibader,
    I understand that you wish to import your photos onto your computer from your iOS device. Here is an article for you that will explain how to accomplish this:
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support
    http://support.apple.com/en-us/HT201302
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • I have my iPhone 4s plugged into a dock and the dock connected to an amplifier, the problem is that the amplifier doesn't have a volume changer and when i plug in the iPhone into the dock the iPhones volume bar disappears. how can i change the volume?app?

    Hi
    I have my iPhone 4s plugged into a dock and the dock connected to an amplifier with 2 speakers and a bass, the problem is that the amplifier doesn't have a volume changer and when i plug in the iPhone into the dock the iPhone´s volume bar disappears and im not allowed to change the volume and its very loud. how can i change the volume? is there an app? any ideas??(my dock doesnt have infrared remote controller )
    TY!!!!

    Kline25 wrote:
    So even if I just ask to pay them to replace the lock button they won't because my screens are third-party?
    Apple does not repair devices beyond replacing the screen on some models or a battery replacement.  They replace the ENTIRE device.
    For the Out of Warranty replacement cost, you could have gotten a fully functional replacement device.  Instead you chose to spend less to get only the screen replaced and continue to live with additional issues.
    Apple will not touch the device now.  They will know that it was opened elsewhere and that the replacement screen is not original.

  • When I add a new contact number to my iphone 5c  and I try to select the iphone choice is not showing up; and it was working fine the day before. ?

    when I add a new contact number to my iphone 5c  and I try to select the iphone choice is not showing up; and it was working fine the day before. ?Also when I try to send an imessage is not going trough as an imessage, it makes me send it as a message.

    You're using Exchange Active Sync to synchronize contacts and calendars with your company Exchange Server. If the default calendar/address books are set to the Exchange account, it will sync automatically. This is normal.
    Go to Settings>Mail, Contacts, Calendars to change the default address book and calendars to a something else, iCloud or something synced from your home computer instead.

  • Photo Stream issue.  Photo Stream shows 263 photos when viewed on the iMac, 289 when viewed on the iPad and 327 when viewed on the iPhone.  How can this be?

    Photo Stream issue.  Photo Stream shows 263 photos when viewed on the iMac, 289 when viewed on the iPad and 327 when viewed on the iPhone.  How can this be?  Tried shut down on all devices, reboot and the results are the same.

    Photo Stream issue.  Photo Stream shows 263 photos when viewed on the iMac, 289 when viewed on the iPad and 327 when viewed on the iPhone.  How can this be?  Tried shut down on all devices, reboot and the results are the same.

  • HT201441 i dont know the previous user of this phone and i'm stuck on the iphone icloud activation process

    i dont know the previous user of this iphone and i'm stuck on the iphone icloud activation process.
    what should i do?

    radhikaven wrote:
    i bought this phone in 2013 from dubai and used till last year june. I dropped the phone and got a problem with display as well as earpiece.
    Later the phone was having a carrier network issue. Was showing searching. i restored the phone to factory settings and when i tried to set up the phone, its showing that the phone cant be activated at this moment, please try again later.
    If your phone was bought second-hand (used) - something you haven't made clear - and it was Activation Locked by the previous owner (this wouldn't show up until you upgraded or reset it) then only he can unlock it. If you can't contact him to do so then you will not be able to use the phone. You can tell if this is the case because it will be asking for an Apple ID (which it will display partially) which is not yours.
    On the other hand if this was a new phone then you may have hit a temporary outage in the activation server and you should wait a bit then try again.

  • How to use lsmw and load cin details of the customer

    hi,
    how to use lsmw and load CIN details of the customer master data as the CIN DETAILS are not visible under XD01.
    thanx in advance
    regards,
    balajit

    i got the solution

  • I 'm French and i want to buy the iphone 5 unlocked in USA

    Hello i'am French and i want to buy the Iphone 5 unlocked in USA. Because i will go to USA. Is it possible ? And how i would do it ?
    Thank You !

    Well mate, this is a bit complicated here in North America (being from Europe myself): in the USA you can as of now only purchase phones locked to the three major carriers and they only support the "local" LTE bands. In Canada (where I live) on the other hand, you can purchase unlocked iPhones (if available!) from any Apple Store. However they also only support the North American LTE frequencies, while in Europe they are slightly different. This is the reason, why Apple sells three different iPhone 5: http://www.wired.com/gadgetlab/2012/09/iphone5-lte-model/.
    So to prevent hassle, I would strongly recommend to purchase the iPhone 5 in Europe.
    Good luck!

  • Two days ago, I have a new iphone 4S. After I installed the OS and start the iphone, I found a strange screen says "!9D/JC" that blocks the iphone and I can not access the iphone until click many times on the "Desmiss"  button at the botom of the screen.

    Two days ago, I have a new iphone 4S. After I installed the OS and start the iphone, I found a strange screen says "!9D/JC" that blocks the iphone and I can not access the iphone until click many times on the "Desmiss" button at the botom of the screen.
    I appreciate if you could provide me support to solve this problem especially it consumes the battery a lot.

    Another post originally dated 5th Feb, 2012 with a slightly different unheard of error "%7D/JC".
    https://discussions.apple.com/thread/3710903?start=0&tstart=0
    The user also claimed that he didn't meddle with iOS. No solution could be found though.

  • WHEN I CONNECT, THROUGH USB CABLE, MY IPHONE TO THE MAC BOOK PRO, THE ITUNES APP STOP RUNNING AND I CAN NOT SYNCRONIZE THE IPHONE

    I have an iphone 4, iOS 7.1.2
    Mac book pro 13in Mid 2012, with OS X VERSION 10.9.4, Processor speed 2.9 Ghz, Memory 8GB 1600MHz DDR3, Intel core i7, Storage capacity 750 GB, 650 GB available.
    WHEN I CONNECT, THROUGH USB CABLE, MY IPHONE TO THE MAC BOOK PRO, THE ITUNES APP STOP RUNNING AND I CAN NOT SYNCRONIZE THE IPHONE.

    Hello skkmmayer,
    That is probably a lot of stuff you do not want on your iPhone. So this can be handled a few different was. For you current situation, you can delete the apps directly on your iPhone by holding on the app until it starts to jiggle and then tap on the X of all the apps that you do not want. The second thing you can do is before you sync with iTunes, look at the app section on your iPhone to know what gets transfer to it and you can deselect items that you do not want. Lastly, if you download content on your iPad and it is a universal app, you can actually download it directly to your iPhone by looking at your past purchases and download it directly from the App Store. Check out the articles below for more information if need further assistance. 
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    iTunes 11 for Mac: Sync and organize iOS apps
    http://support.apple.com/kb/PH12115
    Download past purchases
    http://support.apple.com/kb/HT2519
    Regards,
    -Norm G. 

  • I reset my ipone that i got from my nephew and i need to reactivate the iphone but i dont know his password and it has been locked, he doesn't remember his email address or password to reset his apple id, what can i do to get the iphone activated

    i reset my ipone that i got from my nephew and i need to reactivate the iphone but i dont know his password and it has been locked, he doesn't remember his email address or password to reset his apple id, what can i do to get the iphone activated

    Send him this link and tell him to reset/find the information for his Apple ID.
    (113663)

Maybe you are looking for

  • HT1349 iTunes 11.03.42 problem burning disks Error 4251 with Windows  Vista Service Pack 2

    I am having problems burning a playlist to CD - type Maxell CD-R 80XL. I have been using these successfully for a while. iTunes 11.03.42 updated today Error 4251 and wastes a CD I have run windows registry cleaner I have tested CD drive with diagnost

  • Adobe InDesign classroom in a book

    HEllo, just purchased Adobe InDesign classroom in a book and can't seem to find the lesson files for the textbook. Any suggestions? I've registered the book on peachpit.com as instructed.

  • Using a macbook air?

    Can a macbook air and a external drive work well enough to do basic editing in Fcp? Thanks.

  • Loss of picture quality - HD Go Pro Camer

    I have a go pro helmet cam HD. whe i watch the videos straight off the camera with no editing the picture quality is fantastic. However when i edit the videos in Final cut Express the picture quality goes down. It becomes less clear, and a bit dull.

  • How to write the select query with complex where condition

    Hi all, Can u help me in writing  following select query. select * from zu1cd_corr where time_stamp between firstday and lastday . In the above query time_stamp contains the date and time. where as firstday and lastday contains the dates. I need to c