I am doing below code for getting thumbnail from usdz model using the QuickLookThumbnailing, But don't get the proper out.
guard let url = Bundle.main.url(forResource: resource, withExtension: withExtension) else{
print("Unable to create url for resource.")
return
}
let request = QLThumbnailGenerator.Request(fileAt: url, size: size, scale: 10.0, representationTypes: .all)
let generator = QLThumbnailGenerator.shared
generator.generateRepresentations(for: request) { thumbnail, type, error in
DispatchQueue.main.async {
if thumbnail == nil || error != nil {
print(error)
}else{
let tempImage = Image(uiImage: thumbnail!.uiImage)
print(tempImage)
self.thumbnailImage = Image(uiImage: thumbnail!.uiImage)
print("=============")
}
}
}
}
Below Screen Shot for selected model :
Below is the thumbnail image, which not come with guitar but get only usdz icon.
Hello @Sandip_Aura,
Your screenshot looks like visionOS. The documentation for QLThumbnailGenerator says that it only supports usdz on iOS and iPadOS.
On visionOS, you can use RealityRenderer to render a scene to a thumnail.
Let me know if you run into issues with that approach!