A valid image not being returned from CoreImage in

2019-08-12 16:33发布

问题:

I am trying to get an image using this.

img = new UIImage(new MonoTouch.CoreImage.CIImage(validAssetObject),1.0f, UIImageOrientation.Up);

A CIImage is returned from the CIImage call. The new UIImage has the CIImage property = null.

Seems like the constructor for UIImage is not working as expected?

Any ideas from the MonoTouch community?

回答1:

I wrote a quick test and this seems to work fine.

string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "image.png");
using (var url = NSUrl.FromFilename (file))
using (var ci = CIImage.FromUrl (url))
using (var ui = new UIImage (ci, 1.0f, UIImageOrientation.Up)) {
    Assert.IsNotNull (ui.CIImage, "CIImage");
}

Something else must differ but you have not shared enough source code to compare. Could you create a small test case, with your image, and file a bug report ?