VBA Thumbnail iProperty Yields varying quality, file size, and back color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to collect thumbnails from the Thumbnail iProperty of a document, since this approach is very fast. The stored thumbnail is always 213x213pixels. Sometimes the resolution is great, and sometimes it is very poor. See image below. Not only that, the good resolution images have a dark gray background for some reason and the low res ones have the default. The file size for the good images is 769KB, which is the same size as a 512x512pixel bitmap from Camera.SaveAsBitmap. The low res files are <100KB.
Quality and back color
Here is a snippet of VBA code run from Inventor where I acquire the image.
Dim summaryInfo As PropertySet
Dim thumbprop As Property
Dim thumbNail As IPictureDisp
Set summaryInfo = doc.PropertySets.Item("Inventor Summary Information")
Set thumbprop = summaryInfo.Item("Thumbnail")
Set thumbNail = thumbprop.Value 'Get the thumbnail image.
If Not thumbNail Is Nothing Then 'Check that an image was returned. It's possible for a file to not have a thumbnail.
' Write the thumbnail to disk. Size is 213x213. Even if a larger image is imported. Overwrites existing file.
Call stdole.StdFunctions.SavePicture(thumbNail, strFile)
Else
'MsgBox "The active document doesn't have a thumbnail."
End If
Any ideas for what is causing this difference in results? Maybe some property in the document? One hypothesis I had, although disproved, is if the Master view rep was the only view rep for the document. Is there something else that is causing this? This seems very odd to me.
Many thanks in advance.
Rafael