Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Can't call RepresentationUsingType to create a Png

Scott_BScott_B AUMember ✭✭

I'm trying save some byte data/image out as a Png like this....
var imageRep = NSBitmapImageRep.ImageRepFromData(image.AsTiff());
var data = imageRep.RepresentationUsingType(NSBitmapImageFileType.Png, null);

The RepresentationUsingType method isn't available.

Looking on GitHub I see this:
[Export ("representationUsingType:properties:")]
NSData RepresentationUsingTypeProperties(NSBitmapImageFileType storageType, [NullAllowed] NSDictionary properties);

is that sig correct?

I'm just starting out with macOS, is there another method I should be using? Just need to get a png in the end.

Best Answer


  • Scott_BScott_B AUMember ✭✭

    var imageRep = NSBitmapImageRep.ImageRepFromData(image.AsTiff()) as NSBitmapImageRep;
    var data = imageRep.RepresentationUsingTypeProperties(NSBitmapImageFileType.Png, null);

    does the trick, cheers!

Sign In or Register to comment.