2

I suddenly find out that in iOS 8.3 SDK (I didn't test other versions), I can use [UIImage imageWithData:] to load PVRTC format directly?

It isn't supposed to be like that, right? I can't find any documentation or discussion about it, I don't even know if I can rely on it...

But it does work in both simulators and real devices.

Here are some codes of my test, the test project doesn't include OpenGLES.framework.

NSData *data = THE_CONTENT_OF_A_PVR_FILE;
NSString *tempDir = NSTemporaryDirectory();
[data writeToFile:[tempDir stringByAppendingPathComponent:@"temp.pvr"] atomically:YES];
UIImage *tempImage = [UIImage imageWithData:data];
[UIImagePNGRepresentation(tempImage) writeToFile:[tempDir stringByAppendingPathComponent:@"temp.png"] atomically:YES];

The two saved files are shared here: http://d.pr/f/17ugQ

You can check the pvr file in a HEX editor, it coresponds to the specifications of PVRTC format version 2, with pixel format in PVRTC4.

Any idea?

CocoaBob
  • 533
  • 4
  • 9
  • If the image was generated from `texturetool` UIImage does not understand it. If it came from the PowerVR tools it does. It does not, however, display it in a UIImage view. UIImage correctly reports the dimensions, but will not display it. – quellish Jan 26 '16 at 03:39

0 Answers0