5

In MonoTouch:

I am putting in an image from the Camera into the PhotoAlbum:

ALAssetsLibrary library = new ALAssetsLibrary();
library.WriteImageToSavedPhotosAlbum(photo.CGImage, meta, (assetUrl, error) => {
    library.AssetForUrl(assetUrl, GotAsset, FailedGotAsset);
});

The Photo is all there, works well.

On the delegate GotAsset I am attempting to get out the image, but only the Thumbnail is there. Where is the image?

    void GotAsset(ALAsset asset)
    {
         //asset has only thumbnail info???
    }

Here's what the asset looks like:

enter image description here

Ian Vink
  • 66,960
  • 104
  • 341
  • 555

2 Answers2

4

You're not seeing, at runtime, every properties on devices because, by default, the (managed) linker is enabled (Link SDK). This will remove any code, including properties, your application is not using (and saves tons of KB and deployment times).

You can try to debug this on the simulator (which default to Don't link) by adding your own assets (in the simulator). Another way is to, temporarily, disable the linker on your device builds.

In either cases your ALAsset should be showing all documented properties.

poupou
  • 43,413
  • 6
  • 77
  • 174
  • any idea on how to ready the image file as in File.ReadAllBytes()? I can't use this assets-library url for that. In this specific case I want to upload the file to a server so I need to access the real file path. – nhenrique Mar 30 '15 at 14:42
1

Based on @Poupou's help here's the code I added to make it work:

    void GotAsset(ALAsset asset)
    {
        ALAssetRepresentation rep = asset.DefaultRepresentation;
        var iref = rep.GetImage();
        if(iref!=null)
            DoStuffWithUIImage(UIImage.FromImage(iref));
    }
Ian Vink
  • 66,960
  • 104
  • 341
  • 555