NSBitmapImageRep *aRep = [NSBitmapImageRep imageRepWithData:[toCopy TIFFRepresentation]]; NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:[aRep representationUsingType:NSPNGFileType properties:NULL]]; [wrapper setPreferredFilename:[[NSString stringWithFormat:@"%02d-%d", [[thisMatrix selectedCell] tag], [episodeTable selectedRow]] stringByAppendingPathExtension:@"png"]]; [pb writeFileWrapper:wrapper];