<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iProperty Thumbnail to Image in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678780#M117644</link>
    <description>&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;Hi Mario,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a code snippet that my colleague Philippe Leefsma had recently used for&amp;nbsp;converting the IPictureDisp to a System.Drawing.Image.&lt;/P&gt;
&lt;P&gt;It uses the OleSavePictureFile to save a temporary WMF file which is then read into a System.Drawing.Image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;DllImport("oleaut32.dll", EntryPoint:="OleSavePictureFile", ExactSpelling:=True, PreserveSig:=False, SetLastError:=True)&amp;gt; _
        Public Shared Sub OleSavePictureFile(Picture As stdole.IPictureDisp, &amp;lt;MarshalAs(UnmanagedType.BStr)&amp;gt; filename As String)
        End Sub

Dim oPD As Inventor.IPictureDisp
oPD = thumbProp.Value


'Check that an image was returned.  It's possible for a 
                'file to not have a thumbnail. 
                If oPD Is Nothing Then
                    MsgBox("The active document doesn't have a thumbnail.")
                    Return
                End If

                Dim fileName As String
                fileName = "D:\Temp\PartThumbnail.wmf"
                OleSavePictureFile(oPD, fileName)

                Dim img As System.Drawing.Image
                img = System.Drawing.Image.FromFile(fileName, True)&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jun 2015 09:34:15 GMT</pubDate>
    <dc:creator>Balaji_Ram</dc:creator>
    <dc:date>2015-06-16T09:34:15Z</dc:date>
    <item>
      <title>iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5673283#M117642</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have some Problems to find a Solution to Convert &amp;nbsp;the Thumbnail iProperty Value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  Dim thumbnail As IPictureDisp = thumbProp.Value&lt;/PRE&gt;
&lt;PRE&gt;   Dim objImage As System.Drawing.Image
                objImage = Microsoft.VisualBasic.Compatibility.VB6.Support.IPictureDispToImage(thumbnail)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and all this without ...Support.IPictureDispToImage then this is !!Obsulet!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so &lt;A href="http://modthemachine.typepad.com/my_weblog/wayne-brill.html" target="_blank"&gt;Wayne Brill&lt;/A&gt; &amp;nbsp;have some Solution on this Side but this is Image ==&amp;gt; iPictureDisp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://modthemachine.typepad.com/my_weblog/2012/02/bitmaps-without-vb6-icontoipicture.html" target="_self"&gt;http://modthemachine.typepad.com/my_weblog/2012/02/bitmaps-without-vb6-icontoipicture.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or this in Support Blog from&amp;nbsp;&lt;A href="http://adndevblog.typepad.com/manufacturing/philippe-leefsma.html" target="_self"&gt;Philippe Leefsma&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/manufacturing/2012/06/how-to-convert-iconbitmap-to-ipicturedisp-without-visualbasiccompatibilityvb6supporticontoipicture.html" target="_self"&gt;http://adndevblog.typepad.com/manufacturing/2012/06/how-to-convert-iconbitmap-to-ipicturedisp-without-visualbasiccompatibilityvb6supporticontoipicture.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and the solution from Microsoft or some other Peoples work rundomized most Time not!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Class PictureToImageConverter
    Inherits System.Windows.Forms.AxHost

    Public Sub New()
        MyBase.New("{63109182-966B-4e3c-A8B2-8BC4A88D221C}")
    End Sub

    Public Shared Function Convert(ByVal iPicture As stdole.IPictureDisp) As System.Drawing.Image
        Return CType(System.Windows.Forms.AxHost.GetPictureFromIPicture(iPicture), System.Drawing.Image)
    End Function

End Class
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pls Help thx&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mario&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 11:11:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5673283#M117642</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-11T11:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678669#M117643</link>
      <description>&lt;P&gt;Hi Mario,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im also using the last approach you posted and its working well for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another possible solution could be to directly extract the Thumbnail from the file using the Windows API Code Pack library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example can be found here:&amp;nbsp;&lt;A target="_blank" href="http://stackoverflow.com/questions/1439719/c-sharp-get-thumbnail-from-file-via-windows-api"&gt;http://stackoverflow.com/questions/1439719/c-sharp-get-thumbnail-from-file-via-windows-api&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope it helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 06:39:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678669#M117643</guid>
      <dc:creator>manuel.lanthaler</dc:creator>
      <dc:date>2015-06-16T06:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678780#M117644</link>
      <description>&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;Hi Mario,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a code snippet that my colleague Philippe Leefsma had recently used for&amp;nbsp;converting the IPictureDisp to a System.Drawing.Image.&lt;/P&gt;
&lt;P&gt;It uses the OleSavePictureFile to save a temporary WMF file which is then read into a System.Drawing.Image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;DllImport("oleaut32.dll", EntryPoint:="OleSavePictureFile", ExactSpelling:=True, PreserveSig:=False, SetLastError:=True)&amp;gt; _
        Public Shared Sub OleSavePictureFile(Picture As stdole.IPictureDisp, &amp;lt;MarshalAs(UnmanagedType.BStr)&amp;gt; filename As String)
        End Sub

Dim oPD As Inventor.IPictureDisp
oPD = thumbProp.Value


'Check that an image was returned.  It's possible for a 
                'file to not have a thumbnail. 
                If oPD Is Nothing Then
                    MsgBox("The active document doesn't have a thumbnail.")
                    Return
                End If

                Dim fileName As String
                fileName = "D:\Temp\PartThumbnail.wmf"
                OleSavePictureFile(oPD, fileName)

                Dim img As System.Drawing.Image
                img = System.Drawing.Image.FromFile(fileName, True)&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 09:34:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678780#M117644</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2015-06-16T09:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678861#M117645</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanx for the Answers&lt;/P&gt;&lt;P&gt;is there another Solution to get a&amp;nbsp;"Thumbnail" from Document to a ImageBox without IPictureDisp from iPropertys?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;Mario&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 10:49:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678861#M117645</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-16T10:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678879#M117646</link>
      <description>&lt;P&gt;Hi Mario,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this blog post, Brian explains all the other possibilities.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But i think all of them deal with IPictureDisp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html" target="_blank"&gt;http://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a specific issue that you have with the code that i posted earlier ?&lt;/P&gt;
&lt;P&gt;It saves the WMF to a folder and&amp;nbsp;any image format can be created from it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2015 11:06:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5678879#M117646</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2015-06-16T11:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5679129#M117647</link>
      <description />
      <pubDate>Tue, 16 Jun 2015 13:27:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5679129#M117647</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-16T13:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5679132#M117648</link>
      <description>Works Perfect thx</description>
      <pubDate>Tue, 16 Jun 2015 13:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5679132#M117648</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-16T13:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5720128#M117649</link>
      <description>Yes, It works fine with great performance. (it takes only 2ms in my PC)</description>
      <pubDate>Wed, 15 Jul 2015 05:58:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/5720128#M117649</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-15T05:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: iProperty Thumbnail to Image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/6299714#M117650</link>
      <description>&lt;P&gt;Hello, would you so kind and post the hole code. I like to get the thumbnails as pic.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2016 05:54:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/iproperty-thumbnail-to-image/m-p/6299714#M117650</guid>
      <dc:creator>martinhoos</dc:creator>
      <dc:date>2016-04-29T05:54:47Z</dc:date>
    </item>
  </channel>
</rss>

