Windows Imaging Component (WIC) ForumQuestions and discussion of the Windows Imaging Component APIs.© 2009 Microsoft Corporation. All rights reserved.Thu, 26 Nov 2009 22:03:49 Z4e931954-0d3c-43df-8c51-45fc3e585f11http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/c0327310-94d8-49a6-87ba-fb5efa252447http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/c0327310-94d8-49a6-87ba-fb5efa252447dkieranhttp://social.msdn.microsoft.com/Profile/en-US/?user=dkieranImage interpolationHi, <br/> <p class=MsoNormal><br/> When the screen resolution is changed in XP (in particular when using remote desktop), is the display downscaled using a particular technique and if so what technique is used?<br/> <br/> Also when using remote desktop with the settings all at the correct resolutions on both machines, are there other factors that will affect the final image (GUI) display with the remote desktop applications?<br/> <br/> Something I have noticed that happens when I remote on to my work machine with all settings such as resolution and colour quality set to be the same on both machines, is that two images (one compressed and one uncompressed) that appear to be identical to the naked eye when viewed locally, have distinctly visible artefacts that differ between the two when viewed remotely.  My main question is why this happens?  <br/> <br/> Thank you<br/> Declan</p>Tue, 24 Nov 2009 16:11:30 Z2009-11-26T22:03:49Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/3441a8d6-e097-4597-b5a5-eb1e3599b39bhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/3441a8d6-e097-4597-b5a5-eb1e3599b39bStratfordhttp://social.msdn.microsoft.com/Profile/en-US/?user=StratfordWIA and Canon Raw ImagesHi,<br/><br/>When we use &quot;foreach (WIA.Item item in device.Items)&quot; to loop through the pictures taken by Cannon EOS 350D, if the images are in jpeg format, the code will found it. However, if the pictures are in Raw Image format with .CR2 as the extension, the code device.items.count = 0 and no images can be picked up.<br/><br/>I have installed the Cannon Raw Codec on our Vista machine able to see the pictures thumnail if we copy the pictures manually to the machine but the code still can not find them.<br/><br/>Anything else we need to do to make the code can pick up the images in Raw format/<br/><br/>ThanksFri, 20 Nov 2009 10:21:29 Z2009-11-20T10:21:30Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/18a7669f-8e10-4646-85c9-8909ddfa1550http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/18a7669f-8e10-4646-85c9-8909ddfa1550rctauberthttp://social.msdn.microsoft.com/Profile/en-US/?user=rctaubertImage metadata and WinXPHow do I get WinXP explorer to show metadata (System properties)?  I know the image contains the metadata, I can see it in MS Pro Photo Tools on XP.<br/><br/>But if you try to use the Detail View and select Title, Subject, Keyords, and Comments the info is not there.  <br/><br/>If you right-click on the image file and select properties, again the info is not there.<br/><br/>If you open the image in MS Pro Photo Tools the infor IS there.<br/><br/>I have .net Framework 3.5 installed.  Search 4.0 is installed.  I tried installing the (old) 2006 version of the WIC update and was told a newer copy is already installed.<br/><br/>I have this nice app that I wrote using Windows API Code Pack v1.0 to access image metadata through mangaged code using Shell Properties that works great on Vista.  It runs on XP with out exceptions but does not show the properties.<br/><br/>What else do I need to do??????Fri, 04 Sep 2009 22:14:58 Z2009-11-18T20:02:06Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/3ff819ed-6c92-4ff0-9325-f018270d9719http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/3ff819ed-6c92-4ff0-9325-f018270d9719XavierPhttp://social.msdn.microsoft.com/Profile/en-US/?user=XavierPUnreliable code to generate thumbnails with original metadataHi,<br/> <br/> I want to generate &quot;thumbnails&quot; (I mean here small images keeping the original metadata). Here is my code below. It works most of the times but randomly it raises an exception saying &quot;Can't write datas&quot;.<br/> <br/>             MemoryStream mem;<br/>             BitmapImage ReducedImage;<br/> <br/>             try<br/>             {<br/>                 byte[] buffer = File.ReadAllBytes(path);<br/>                 // by reading the data into an in-memory buffer, we prevent the file from being read in the UI thread <br/>                 // -- which speeds up access dramatically!<br/>                 using (mem = new MemoryStream(buffer))<br/>                 {<br/>                     // Create a small version of it !<br/>                     ReducedImage = new BitmapImage();<br/>                     ReducedImage.BeginInit();<br/>                     ReducedImage.DecodePixelWidth = DataManager.TManager.ThumbSize;<br/>                     ReducedImage.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;<br/>                     ReducedImage.CacheOption = BitmapCacheOption.Default;<br/>                     ReducedImage.StreamSource = mem;<br/>                     ReducedImage.EndInit();<br/>                     ReducedImage.Freeze();<br/> <br/>                     // Create a thumbnail for next time !!!<br/> <br/>                     JpegBitmapEncoder enco = new JpegBitmapEncoder(); <br/>                     enco.QualityLevel = 30;<br/> <br/>                     MemoryStream mem2 = new MemoryStream(buffer);<br/>                     BitmapFrame _image = BitmapFrame.Create(mem2, BitmapCreateOptions.None, BitmapCacheOption.None);<br/>                     BitmapMetadata metadata = _image.Metadata as BitmapMetadata;<br/>                     BitmapFrame bf = BitmapFrame.Create(ReducedImage, null, metadata, null);<br/>                     <br/>                     enco.Frames.Add(bf);<br/>                     string ftb = DataManager.TManager.ThumbPath(path);<br/>                     FileStream stream;<br/>                     string dir_name = DirectoryName(ftb);<br/>                     if (!Directory.Exists(dir_name))<br/>                         Directory.CreateDirectory(dir_name);<br/>                     stream = new FileStream(ftb, FileMode.Create);<br/>                     enco.Save(stream);<br/>                     stream.Flush();<br/>                     stream.Close();<br/>                 }<br/>                 return true;<br/> <br/> PS: Called from a WPF application.<br/> <br/> Any ideas ?<br/> Thanks !<br/>Sun, 10 May 2009 14:29:28 Z2009-11-18T19:41:55Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/a7da4b3a-31c5-4be4-bb04-5fedb00f61e8http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/a7da4b3a-31c5-4be4-bb04-5fedb00f61e8Nathan_Vhttp://social.msdn.microsoft.com/Profile/en-US/?user=Nathan_VAdding custom XMP metadataI am trying to add custom XMP metadata to JPG files via BitmapMetadata.SetQuery.   My code works fine for modifying predefined metadata but I am stuck on trying to use a custom schema in a namespace.  I have read the relevent portions of the XMP spec but don't see any exposed methods to define a custom namespace in the metadata.  I tried this WAG approach:<br/> <br/>           BitmapMetadata metadata = frame.Metadata.Clone() as BitmapMetadata;<br/>           // I figure I only need to pad /XMP but for now I pad EVERYTHING<br/>           metadata.SetQuery(&quot;/app1/ifd/PaddingSchema:Padding&quot;, paddingAmount);<br/>           metadata.SetQuery(&quot;/app1/ifd/exif/PaddingSchema:Padding&quot;, paddingAmount);<br/>           metadata.SetQuery(&quot;/xmp/PaddingSchema:Padding&quot;, paddingAmount);<br/>           // Now add data using my totally made up namespace.<br/>           metadata.SetQuery(&quot;/xmp/NX:NXData&quot;, &quot;Hello World&quot;);<br/> <br/> This &quot;works&quot; in that SetQuery succeeds but when I try to save the file I get an overflow exception.  If I change the query to a known good metadata field it works fine.    I hope I am missing something obvious here but nothing about this project has been obvious so far...<br/> <br/> Thanks,<br/> Nathan<br/>Fri, 05 Jun 2009 14:27:46 Z2009-11-18T19:36:11Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/eb6b8857-6949-4679-aa73-8f1ae7fae55ehttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/eb6b8857-6949-4679-aa73-8f1ae7fae55esryadnohttp://social.msdn.microsoft.com/Profile/en-US/?user=sryadnoProblem with open new image format in Vista Photo GalleryHi, i create WIC based image decoder for my own image format. I can successful view this files in WICExplorer application. But then i try to open image in Vista Photo Gallery i found problems. First of all, i have made all registry modification described in <a href="http://msdn.microsoft.com/en-us/library/aa905327.aspx">http://msdn.microsoft.com/en-us/library/aa905327.aspx</a>. And now i can view image in Photo Galley, but only if i do next steps - right click on image file-&gt;&quot;Open with&quot;-&gt; choose in appeared dialog &quot;Vista Photo gallery&quot;. Then i try to open image with left button double cllick  - Gallery opens successful but without any image. What i must do to view image in Photo Gallery with &quot;double click&quot; action on image file? <div><br/></div>Thu, 05 Nov 2009 10:40:49 Z2009-11-18T19:26:03Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/2697fb67-40a4-42e2-9456-ad940bd62dcbhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/2697fb67-40a4-42e2-9456-ad940bd62dcbc.glasgowhttp://social.msdn.microsoft.com/Profile/en-US/?user=c.glasgowWPF and custom XMP attributesHi all.<br/> <br/> I'm attempting to define a custom xmp schema using BitmapMetadata, and have run into a bit of a hitch.<br/> <br/> The short version of my code looks something like this:<br/> <br/> <pre lang="x-c#">BitmapMetadata meta = SomeBitmapFrame.Metadata.Clone() as BitmapMetaData; meta.SetQuery(&quot;/xmp/dc:MyCustomDC&quot;, new BitmapMetadata(&quot;xmpbag&quot;)); meta.SetQuery(&quot;/xmp/dc:MyCustomDC/MyCustomProp&quot;, &quot;test string&quot;); // throws exception &quot;Property cannot be found.&quot; </pre> Could someone point out what I'm doing wrong?<br/> <br/> <br/> Thanks in advance.Wed, 29 Jul 2009 00:36:27 Z2009-11-04T06:22:52Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/efdf40a9-518a-432d-bc38-a537d8b79b0ahttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/efdf40a9-518a-432d-bc38-a537d8b79b0aATGardnerhttp://social.msdn.microsoft.com/Profile/en-US/?user=ATGardnerWriting latitude and longitude using policiesI am trying to write the above values, using the &quot;System.GPS.Latitude&quot; and &quot;System.GPS.Longitude&quot; policies.<br>First, I tried using the &quot;Numerator&quot;/&quot;Denominator&quot; option to write URational data, but since I have a URational[3] in here, it doesn't seem reasonable.<br>I couldn't find a way to write a coordinate using the policies. Only using the direct xmp or exif query strings.<br>with xmp, I should use a string, with exif, I use a ulong[3] array.<br><br>this.metadata.SetQuery(&quot;/xmp/exif:GPSLatitude&quot;, &quot;3223&quot;);<br><br>or<br><br>this.metadata.SetQuery(&quot;/app1/ifd/gps/{ushort=2}&quot;, new ulong[]{1, 2, 3});<br><br>seem to work, but I am looking for something like<br><br>this.metadata.SetQuery(&quot;System.GPS.Latitude&quot;, value)<br><br>where value is ulong[3] or string (or whatever else it can be...), and it would set both the xmp and the exif to the proper values.<br><br>Am I hoping for too much?<br>Thu, 12 Feb 2009 17:43:35 Z2009-11-04T06:20:10Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/159f204c-3492-4f7d-ab27-0a514c4ba519http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/159f204c-3492-4f7d-ab27-0a514c4ba519Watershttp://social.msdn.microsoft.com/Profile/en-US/?user=WatersThe handle is invalid - Exception from HRESULT: 0x80070006 (E_HANDLE)I'm trying to create a new (and smaller) JPEG file - based on a source JPEG - and then copy the metadata from the original JPEG to the new JPEG - and I'm getting the following exception at random intervals. <br/> <br/> The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE)).<br/> <br/> Here's the code I'm using to create the new JPEG and conditionally place a copy of the metadata from the old JPEG into the new one if requested.<br/> <br/> NOTE: The exception is ONLY thrown (and even then on totally random occasions) when the option to IncludeMetadata is true. About one in 50 or one in 100 times will throw this exception. Adding the frame to the encoder without metadata is fine.<br/> <br/> var source = new Uri(SourceFile);<br/> //We load a frame first so that we can 'peak' and get the image dimensions - this should be fast.<br/> var frame = BitmapFrame.Create(source,<br/>                        BitmapCreateOptions.IgnoreColorProfile |<br/>                        BitmapCreateOptions.IgnoreImageCache |<br/>                        BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);<br/> <br/> var bmp = new BitmapImage();<br/> bmp.CacheOption = BitmapCacheOption.Default;<br/> bmp.BeginInit();                    <br/> <br/> if (frame.PixelWidth &lt;= frame.PixelHeight)<br/> {<br/>     bmp.DecodePixelWidth = MaxDimension;<br/> }<br/> else<br/> {<br/>     bmp.DecodePixelHeight = MaxDimension;<br/> }<br/> <br/> bmp.UriSource = source;<br/> bmp.EndInit();               <br/> <br/> using (FileStream writer = new FileStream(TargetFile, FileMode.Create))<br/> {<br/>     var encoder = new JpegBitmapEncoder();<br/>     encoder.QualityLevel = Quality;<br/> <br/>     if (IncludeMetadata)<br/>     {                            <br/>         BitmapMetadata bitmapMetadata = frame.Metadata.Clone() as BitmapMetadata;                            <br/>         encoder.Frames.Add(BitmapFrame.Create(bmp, null, bitmapMetadata, frame.ColorContexts));<br/>     }<br/>     else<br/>     {<br/>         encoder.Frames.Add(BitmapFrame.Create(bmp, null, null, frame.ColorContexts));<br/>     }<br/> <br/>     encoder.Save(writer);<br/>     writer.Flush();                        <br/> }<br/> <br/> Thoughts?Sun, 06 Sep 2009 11:03:03 Z2009-11-04T06:17:14Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/9d51fbd6-b379-4b26-bd51-70f43649ca3ahttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/9d51fbd6-b379-4b26-bd51-70f43649ca3aLi2007http://social.msdn.microsoft.com/Profile/en-US/?user=Li2007How to add people tagging metadata<p>I'm writing people tagging metadata to a jpg file that has yet no xmp block. Here is my code:</p> <p>// add padding here already</p> <p>...</p> <p>// This works fine as I can see&nbsp;RegionInfo is created with WICExplorer</p> <p>bitmapMetadata.SetQuery("/xmp/MP:RegionInfo", new BitmapMetadata("xmpstruct"));</p> <p>// This works fine as I can see Regions is created with WICExplorer</p> <p>bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions", new BitmapMetadata("xmpbag"));</p> <p>// This works fine as I can see 0 (XMP Struct Reader) is created with WICExplorer</p> <p>bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions/{ulong=0}", new BitmapMetadata("xmpstruct"));</p> <p>// These two statement&nbsp;give System.AccessViolationException. Why?</p> <p>bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions/{ulong=0}/PersonDisplayName", "somename"));</p> <p>bitmapMetadata.SetQuery("/xmp/MP:RegionInfo/MPRI:Regions/{ulong=0}/Rectangle", "somerectangle"));</p> <p>//...others&nbsp;as... jpegEncoder.Frames.Add(...</p> <p>The last two SetQuery() statements are not working. I don't know why? Could you help me out? Thanks!</p>Tue, 06 Oct 2009 20:54:54 Z2009-11-04T06:15:32Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e05f4bc2-1f5c-4a10-bd73-86a676dec554http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e05f4bc2-1f5c-4a10-bd73-86a676dec554Nazzahttp://social.msdn.microsoft.com/Profile/en-US/?user=NazzaProblem encoding TIFF, the compression is always LZWHi, I'm trying to encode a Bitmap array to a multipage TIFF.<br/>The Bitmaps are 1 bit depth (verified), I force the CCITT4compression, but the result is always LZW compression.<br/><br/>The code:<br/> <pre lang="x-c#">Bitmap[] IncomingArray; MemoryStream _stream = new MemoryStream(); Image TempImage; Encoder myEncoder = Encoder.SaveFlag; ImageCodecInfo infoEncoder = GetEncoderInf(ImageFormat.Tiff); foreach (ImageCodecInfo ici in ImageCodecInfo.GetImageEncoders()) if (ici.MimeType == &quot;image/tiff&quot;) infoEncoder = ici; EncoderParameters myEncoderParameters = new EncoderParameters(2); myEncoderParameters.Param[0] = new EncoderParameter(myEncoder, (long)EncoderValue.MultiFrame); myEncoderParameters.Param[1] = new EncoderParameter(myEncoder, (long)EncoderValue.CompressionCCITT4); TempImage = (Image)IncomingArray[0]; TempImage.Save(_stream, infoEncoder, myEncoderParameters); if (IncomingArray.Length &gt; 1) { myEncoderParameters.Param[0] = new EncoderParameter(myEncoder, (long)EncoderValue.FrameDimensionPage); for (int iCount = 1; iCount &lt; IncomingArray.Length; iCount++) { TempImage.SaveAdd((Image)IncomingArray[iCount], myEncoderParameters); } } myEncoderParameters.Param[0] = new EncoderParameter(myEncoder, (long)EncoderValue.Flush); TempImage.SaveAdd(myEncoderParameters); //_stream.Seek(0, SeekOrigin.Begin); _stream.Position = 0; File.WriteAllBytes(&quot;c:\\test.tif&quot;, _stream.ToArray()); </pre> <p>Looking at tags, test.tif is 1 bit depth, but is encoded LZW...</p> <p>If the image is 1 bit depth, why it isn't compressed CCITT4 ?</p> <p> </p>Wed, 28 Oct 2009 15:59:34 Z2009-11-03T15:07:11Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/eb12e493-257d-481d-bd28-a0f232dc52e5http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/eb12e493-257d-481d-bd28-a0f232dc52e5zarachishttp://social.msdn.microsoft.com/Profile/en-US/?user=zarachisHow to use WIC in C# project<div><span style="background-color:#ffffff">i have two basic questions on WIC</span></div> <div><span style="background-color:#ffffff">1) how to install WIC</span></div> <div>2) how to setup my c# project to use WIC</div> <div>can anyone provide any explanations or useful links ? thanks!</div> <div><br/></div>Sun, 25 Oct 2009 07:30:54 Z2009-11-02T19:21:39Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/573c0e9b-a679-4d7a-8262-8e081b089789http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/573c0e9b-a679-4d7a-8262-8e081b089789maddiharleighhttp://social.msdn.microsoft.com/Profile/en-US/?user=maddiharleighError code 646 with update 971644I keep on getting and error code 646 when I download the platform update for windows vista KB971644. Can someone please help?Fri, 30 Oct 2009 15:27:59 Z2009-10-30T15:27:59Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e13ef63b-5ae6-4744-82d0-389e7c44895fhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e13ef63b-5ae6-4744-82d0-389e7c44895fMichael Beasleyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20BeasleyAnybody successfully able to use WIC on Vista SP1or SP2 to read XMP CreatorContactInfo from the Adobe XMP Toolkit version 4+?I am trying to read embedded metadata from jpeg and tiff images with C# and add them to a database for other uses.<br/> <br/> I can successfully read almost everything I need, including my own Photoshop custom XMP template derived metadata, but not any of the Iptc4xmp CreatorContactInfo xmp metadata which I really, REALLY need for my purposes.<br/> <br/> If I am reading a blog post by Bob Wlodarczyk (at http://blogs.msdn.com/rwlodarc/archive/2006/03/30/565138.aspx) correctly, the metadata Query strings for jpeg image embedded CreatorContactInfo address metadata:<br/>       /xmp/CreatorContactInfo/CiAdrExtadr<br/> and<br/>       /xmp/http\:\/\/iptc.org\/std\/Iptc4xmpCore\/1.0\/xmlns\/:CreatorContactInfo/http\:\/\/iptc.org\/std\/Iptc4xmpCore\/1.0\/xmlns\/:CiAdrExtadr<br/> <br/> should work successfully in Vista, but my test  images (that show the metadata in Photoshop CS2, written by either Photoshop CS2, CS3, or CS4) do not seem to be able to successfully retrieve any CreatorContactInfo metadata items, eg:<br/> <br/>       BitmapMetadata theBitmapMetadata = ...;<br/>       string m_CreatorCiAdrExtadr = theBitmapMetadata.GetQuery( &quot;/xmp/CreatorContactInfo/CiAdrExtadr&quot; ) as string;<br/> <br/> in a commandline STAThread marked application (VS2008, Vista Sp1, PresentationCore.dll version 3.0.0.0 runtime version v2.0.50727) ALWAYS seems to throw an Exception &quot;Unexpected type of metadata&quot; and ContainsQuery( &quot;/xmp/CreatorContactInfo/CiAdrExtadr&quot; ) always returns false.<br/> <br/> Also, the WICExplorer tool (from the download http://www.microsoft.com/downloads/details.aspx?FamilyID=a6d6ec6a-e4f2-405e-842d-7c3bcb5b1390&amp;displaylang=en) fails to show the CreatorContactInfo in the images, which when extracted reads (for one particular instance):<br/> <br/>             &lt;Iptc4xmpCore:CreatorContactInfo Iptc4xmpCore:CiAdrExtadr=&quot;625 East 14th St 4d&quot; Iptc4xmpCore:CiAdrCity=&quot;New York&quot; Iptc4xmpCore:CiAdrRegion=&quot;NY&quot; Iptc4xmpCore:CiAdrPcode=&quot;10009&quot; Iptc4xmpCore:CiAdrCtry=&quot;USA&quot; Iptc4xmpCore:CiTelWork=&quot;917.555.1212&quot; Iptc4xmpCore:CiEmailWork=&quot;nobody@nowhere.com&quot; Iptc4xmpCore:CiUrlWork=&quot;www.nowhere.com&quot;/&gt;<br/> <br/> and was generated in this instance by &quot;Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:13:43        &quot; from Photoshop CS3.<br/> <br/> Has anyone successfully read this CreatorContactInfo metadata under Vista/XP/Server 2008 using WIC????<br/> <br/> If there is an issue under Vista/XP/Server 2008 with the current WIC, will it be possible to successfully read this under Windows 7 WIC RTM (and hopefully in an updated component in these &quot;older&quot; OS's)??<br/> <br/> Looking for whatever help I can find without having to use the Adobe SDK and wrapping it in C#, TIA.<br/> <br/> <br/> <br/> <br/> <br/>Wed, 29 Apr 2009 21:07:43 Z2009-10-29T19:29:37Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/3df9da94-3411-4176-a25f-20089b91861ehttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/3df9da94-3411-4176-a25f-20089b91861eMichael Beasleyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20BeasleyWill the "Platform Update for Windows Vista" fix the WIC issues with "flattened" XMP metadata as generated by the current version of the Adobe XMP toolkit version 4+To Bob W and the WIC team: will the &quot;Platform Update for Windows Vista&quot; and WIC under Windows 7 fix the WIC issues properly handling &quot;flattened attribute&quot; style instead of hierarchical XMP metadata as generated by the current version of the Adobe XMP Toolkit version 4+ used in Adobe Photoshop CS3 and CS4 (ie: CS3 was released in beta in December 2006, and final released April 16 2007 using the Adobe XMP Toolkit version 4)??<br/> <br/> See specifically my posting <span style="font-family:Arial;font-size:x-small"><span style="font-family:Arial;font-size:10pt"><a title="blocked::http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e13ef63b-5ae6-4744-82d0-389e7c44895f" href="windowswic/thread/e13ef63b-5ae6-4744-82d0-389e7c44895f" title="blocked::http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e13ef63b-5ae6-4744-82d0-389e7c44895f">http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e13ef63b-5ae6-4744-82d0-389e7c44895f</a> &quot;</span> </span> <span>Anybody successfully able to use WIC on Vista SP1 to read XMP CreatorContactInfo?&quot; which notes an extracted problematic IPTC4XMP XMP CreatorContactInfo structure </span> <span>(with appropriate demonstation code and output) </span> <span>from CS3 that can be read by </span> Adobe XMP Toolkit version 3 or 4<span>, but that cannot be properly read by WIC on Vista SP2 fully patched as of 25 October 2009 save for the beta of the </span> &quot;Platform Update for Windows Vista&quot;<span><br/> <br/> If this </span> &quot;Platform Update for Windows Vista&quot;<span> will fix WIC on Vista, when can we expect the final version to be delivered via Update (it is noted as &quot;...</span> <span style="font-size:small"><span style="font-family:Calibri"><span>shortly after Windows 7 general availability&quot; which has now happened)</span> </span> </span> <span>??<br/> <br/> (for those interested, reference: http://blogs.msdn.com/directx/archive/2009/09/10/windows-7-transition-pack-for-windows-vista.aspx and http://www.microsoft.com/downloads/details.aspx?FamilyId=081c218f-c845-47d1-b124-71f80bf21638&amp;displaylang=en)<br/> <br/> Cordially,<br/> Michael Beasley<br/> </span>Sun, 25 Oct 2009 19:21:15 Z2009-10-29T19:26:43Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/c617b5a1-de2d-49af-84c8-a227ba6d10d2http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/c617b5a1-de2d-49af-84c8-a227ba6d10d2codekaizenhttp://social.msdn.microsoft.com/Profile/en-US/?user=codekaizenHow to set a specific TIFF tag via BitmapMetadata.SetQuery?Greetings,<br /><br />I'm trying to write a TIFF file with the TIFF tag called "PhotometricInterpretation" (262) to the value 1, which means that a minimum sample value is black instead of white. <br /><br />Here is the code I'm using, which apparently sets the specified tag, but does not set the intended tag:<br /> <div style="BACKGROUND-COLOR: white; MARGIN-TOP: 1em; COLOR: black; MARGIN-LEFT: 1em"> <pre>BitmapMetadata metadata = <span style="COLOR: blue">new</span> BitmapMetadata(<span style="COLOR: #a31515">"tiff"</span>); metadata.SetQuery(<span style="COLOR: #a31515">"/ifd/{ushort=262}"</span>, 1); <span style="COLOR: blue">var</span> frame = BitmapFrame.Create(bitmapSource, <span style="COLOR: blue">null</span>, metadata, <span style="COLOR: blue">null</span>); TiffBitmapEncoder encoder = <span style="COLOR: blue">new</span> TiffBitmapEncoder { Compression = TiffCompressOption.Ccitt4 }; encoder.Frames.Clear(); encoder.Frames.Add(frame); <span style="COLOR: blue">using</span> (<span style="COLOR: blue">var</span> saveImageFile = File.Create(<span style="COLOR: #a31515">"Save.tif"</span>)) { encoder.Save(saveImageFile); } </pre> </div> I have not found much after studying the WIC metadata and query language which would indicate that this is not correct. Any insights on how I can get this tag set correctly?<br /><br />Thanks!Sun, 11 Oct 2009 00:27:13 Z2009-10-29T03:30:16Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/7eddcff8-42ad-47ac-a32e-d274fa9324c9http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/7eddcff8-42ad-47ac-a32e-d274fa9324c9vickyalonehttp://social.msdn.microsoft.com/Profile/en-US/?user=vickyaloneAIT fail in Vista and WIN7Hi Experts...<br/>              I am able to run and digitally sign the dll on XP machine and even I am able to create my own sample image format. But when I tried to digitally sign the AitCodec.dll on vista and WIn7 , it fails and I am not able to see the AitEncoder in available encoder in WIC explorer . I won't be able to recognise , why dll registry entry can't be created for AIT format in the registry.<br/><br/>Thanks &amp; Regards<br/>Vicky Fri, 04 Sep 2009 09:33:48 Z2009-10-27T08:27:21Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/5a3c5f2e-348f-4ed6-a552-59acfe012870http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/5a3c5f2e-348f-4ed6-a552-59acfe012870vickyalonehttp://social.msdn.microsoft.com/Profile/en-US/?user=vickyaloneWIC Codec fail in Vista And Window 7 OSHi Experts,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I developed a WIC codec that support a new image format suppose XYZ format(codec named ,XYZ Encoder)&nbsp;which can encode an image in to XYZ format and image created in such format can get open succesfully in WIC explorer.<br /><br />But when I tried to test my codec on Vista or Window 7 machine. It doesn't work . As I try to convert an image in to XYZ format in Vista machine using WIC explorer, WIC explorer doesn't find any such encoder named XYZ Encoder in their available encoder list. My codec is woking fine in XP machine. If anybody faced the similar kinda problem, then please help me in this regard.<br /><br />Thanks &amp; Regards<br />VickyFri, 09 Oct 2009 07:33:27 Z2009-10-26T12:52:08Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/151322f4-dc0a-4796-b99c-8bd7ae071c8fhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/151322f4-dc0a-4796-b99c-8bd7ae071c8fmadhav_1http://social.msdn.microsoft.com/Profile/en-US/?user=madhav_1Save DrawingGroup Image to CMYK Pixelformat Directly without losing CMYK ratioHi Freinds,<br/><br/>I am Trying to Save DrawingGroup Image with Tiff Drawings. Without losing the CMYK format how it is possible to maintain the Pixelformat to CMYK while Saving the file. I appreciate any reply pls.<br/><br/><br/>Thanks &amp; Regards<br/><br/>madhavFri, 25 Sep 2009 09:25:08 Z2009-10-20T13:50:18Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/13d2cfd4-40dc-42be-b102-e1cc4262660fhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/13d2cfd4-40dc-42be-b102-e1cc4262660fPeter Herijgershttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20HerijgersHow to use the IWICDevelopRaw interfaceAre there some examples available on how to use the IWICDevelopRaw interface?<br/>Like how to initiate one.<br/><br/>ThanksMon, 28 Sep 2009 16:32:43 Z2009-10-01T19:54:57Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/20e22e6e-954d-4d85-a55c-cd985eddda5chttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/20e22e6e-954d-4d85-a55c-cd985eddda5cfgvictorhttp://social.msdn.microsoft.com/Profile/en-US/?user=fgvictorEncode to PNG-8Hello<br/> How to encode IWICBitmapSource(PixelFormat = GUID_WICPixelFormat32bppPBGRA) in &quot;PNG-8&quot;(ContainerFormat = GUID_ContainerFormatPng, PixelFormat = GUID_WICPixelFormat8bppIndexed) without transparency<br/>Tue, 15 Sep 2009 14:41:06 Z2009-09-15T14:41:07Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/bbed979d-ae1e-48f1-91b9-7cd3b065eed9http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/bbed979d-ae1e-48f1-91b9-7cd3b065eed9sathaadjhttp://social.msdn.microsoft.com/Profile/en-US/?user=sathaadjWIC JPEG Decoder Fails in CopyPixels() with H_RESULT = 0x88982F60 ON HIGH CPU UTILIZATION!!!!Hi,<br/> <br/>    I am using WIC Jpeg Decoder for real time streaming. I am facing this strange problem where in my CopyPixels() function will<br/> fail with HR - 0x88982F60 which means WINCODEC_ERR_BADIMAGE. But i tried storing this in to a seperate .jpg file and able to<br/> see it in the &quot;Windows  Picture and Fax Viewer&quot; properly. I have designed a direct show filter to handle this decoding.<br/> <br/>    Most interestingly this issue happens only when the CPU utilization is above 90 - 100%. I am using  Visual Studio 2005 and <br/> XP SP 3 with .Net Framework 3.5 SP1. Now whenever i face this problem WIC Jpeg Decoder is not able to decode any image<br/> after this failure, every CopyPixels() operation fails with the same HR.<br/> <br/>   Can some one help me in resolving this problem?<br/><hr class="sig">sathaadjWed, 09 Sep 2009 11:46:19 Z2009-09-09T11:46:20Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/7497e982-8446-4077-a22c-2974b455b655http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/7497e982-8446-4077-a22c-2974b455b655PavanNittalahttp://social.msdn.microsoft.com/Profile/en-US/?user=PavanNittalaConvert YUV 420 to JPEG Hi All,<br/><br/>I want to Convert a YUV 420 frame to JPEG image and store it . Plz let me know the best approach to this problem using WinCE imaging factory .  I used IJG and could easily get the JPEG but i strictly want to use WinCE Apis only .  I tried these steps but could not succed . The PushPixelData was always retuting FALSE <br/><br/>1.  Convert YUV420 to RGB 565 <br/>2.   CreateBitmapFromBuffer<br/>3.   GetInstalledEncoders and Search for JPEG encoder <br/>4.   CreateImageEncoderToFile<br/>5.   GetEncodeSink<br/>6.   BeginSink<br/>7.   SetPallette<br/>8.   PushPixelData<br/>9.   EndSink<br/>10.   Release and Terminate  .<br/><br/> Tue, 08 Sep 2009 08:39:09 Z2009-09-08T08:39:09Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/8145928a-3988-4112-8a3c-6711b90e77cchttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/8145928a-3988-4112-8a3c-6711b90e77ccrwong_002http://social.msdn.microsoft.com/Profile/en-US/?user=rwong_002TIFF Group 4 Fax images written with a FillOrder tag of 0.<p align=left>Hello everyone,</p> <p align=left> </p> <p align=left>I have written a small program with WIC to read a Black and white TIFF image and write it in TIFF Group 4 Fax format. Sonehow, the FillOrder tag (IFD tag 266) in the output image are all set to zero.</p> <p align=left> </p> <p align=left>This is strange because (1) ExifTool says the meaning of a FillOrder value of zero is unknown, and (2) Some programs cannot open these images. </p> <p align=left> </p> <p align=left>To test this issue, I have used ExifTool to set this value back to 1. After this step, those programs can now open these images. If I now use WIC to read this modified image and write it back in TIFF Group 4 Fax again, however, the value is set to zero again. Please see the test code below.</p> <p align=left> </p> <p align=left>It appears that this metadata value is generated by the image frame encoder, and cannot be written to by MetadataWriter or MetadataQueryWriter.</p> <p align=left> </p> <p align=left>As a side note, the symptom matches the description on this page: <span style="font-size:10pt;font-family:Arial"><a title="http://www.eggheadcafe.com/software/aspnet/29999874/tiffbitmapencoder-bug.aspx" href="http://www.eggheadcafe.com/software/aspnet/29999874/tiffbitmapencoder-bug.aspx"><font color="#800080">http://www.eggheadcafe.com/software/aspnet/29999874/tiffbitmapencoder-bug.aspx</font></a>, </span></p> <p align=left><span style="font-size:10pt;font-family:Arial"></span> </p> <p align=left><span style="font-size:10pt;font-family:Arial">This is my WIC version:</p> <p align=left>WindowsCodecs.dll:</p> <p align=left>6.0.5840.16388 (winmain(wmbla).061024-1209)   size: 716,288 bytes</p> <p align=left> </p> <p align=left>WindowsCodecsExt.dll:</p> <p align=left>6.0.5840.16388 (winmain(wmbla).061024-1209)</p> <p align=left> </p> <p align=left>Is this the latest version available for Windows XP SP2? I know that the Windows 7 version fixes a lot of bugs. Will these fixed be available to XP SP2 users?</p> <p align=left> </p> <p align=left>Has anybody meet the same problem?</p> <p align=left> </p> <p align=left>Thanks!</p></span> <p> </p> <p align=left> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p align=left>void TestExecute(const wchar_t* lpszInputFile, const wchar_t* lpszOutputFile)<br>{<br>    IWICImagingFactoryPtr pFactory;<br>    IWICBitmapDecoderPtr pFileReader;<br>    IWICBitmapFrameDecodePtr pFrameReader;<br>    IWICBitmapSourcePtr  pFrameImage;<br>    <br>    IWICStreamPtr pOutStream;<br>    IWICBitmapEncoderPtr pFileWriter;<br>    WICBitmapEncoderCacheOption cacheOption = WICBitmapEncoderNoCache;<br>    GUID encoderGuid = GUID_ContainerFormatTiff;<br>    IWICBitmapFrameEncodePtr frameEncoder;<br>    IPropertyBag2Ptr frameSettings;</p> <p align=left>    CoCreateInstance(CLSID_WICImagingFactory, <br>        NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, <br>        (LPVOID*) &amp;pFactory);</p> <p align=left>    pFactory-&gt;CreateDecoderFromFilename(<br>        lpszInputFile, <br>        NULL, <br>        GENERIC_READ, <br>        WICDecodeMetadataCacheOnDemand, <br>        &amp;pFileReader);</p> <p align=left>    pFileReader-&gt;GetFrame(0, &amp;pFrameReader);<br>    pFrameImage = pFrameReader;</p> <p align=left>    pFactory-&gt;CreateStream(&amp;pOutStream);<br>    pOutStream-&gt;InitializeFromFilename(lpszOutputFile, GENERIC_WRITE);</p> <p align=left>    pFactory-&gt;CreateEncoder(encoderGuid, NULL, &amp;pFileWriter);</p> <p align=left>    pFileWriter-&gt;Initialize(pOutStream, cacheOption);<br>    pFileWriter-&gt;CreateNewFrame(&amp;frameEncoder, &amp;frameSettings);</p> <p align=left>    CComVariant optValue((BYTE) WICTiffCompressionCCITT4);<br>    PROPBAG2 optName = {0};<br>    optName.pstrName = L&quot;TiffCompressionMethod&quot;;<br>    optName.dwType = PROPBAG2_TYPE_DATA;<br>    optName.vt = VT_UI1;</p> <p align=left>    frameSettings-&gt;Write(1, &amp;optName, &amp;optValue);</p> <p align=left>    frameEncoder-&gt;Initialize(frameSettings);</p> <p align=left>    UINT imgWidth = 0; <br>    UINT imgHeight = 0; <br>    GUID pixelFormat = {0};<br>    double DpiX = 300.0; <br>    double DpiY = 300.0;</p> <p align=left>    pFrameImage-&gt;GetSize(&amp;imgWidth, &amp;imgHeight);<br>    pFrameImage-&gt;GetPixelFormat(&amp;pixelFormat);<br>    pFrameImage-&gt;GetResolution(&amp;DpiX, &amp;DpiY);</p> <p align=left>    frameEncoder-&gt;SetSize(imgWidth, imgHeight);<br>    frameEncoder-&gt;SetPixelFormat(&amp;pixelFormat);<br>    frameEncoder-&gt;SetResolution(DpiX, DpiY);</p> <p align=left>    IWICPalettePtr  pPalette;<br>    pFactory-&gt;CreatePalette(&amp;pPalette);<br>    pPalette-&gt;InitializePredefined(WICBitmapPaletteTypeFixedBW, FALSE);<br>    frameEncoder-&gt;SetPalette(pPalette);</p> <p align=left>    frameEncoder-&gt;WriteSource(pFrameImage, 0);</p> <p align=left>    frameEncoder-&gt;Commit();<br>    pFileWriter-&gt;Commit();<br>}</p></div></div> <p align=left> </p> <p align=left>Output from WICExplorer:</p> <p align=left> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p align=left>\output_5.tif\Frame #0\Ifd Reader</p> <p align=left>Metadata Values<br>254 (UI2)  0 (UI4)<br>256 (UI2)  2960 (UI2)<br>257 (UI2)  1050 (UI2)<br>258 (UI2)  1 (UI2)<br>259 (UI2)  4 (UI2)<br>262 (UI2)  0 (UI2)<br>266 (UI2)  0 (UI2)<br>273 (UI2)  8 (UI4)<br>277 (UI2)  1 (UI2)<br>278 (UI2)  1050 (UI4)<br>279 (UI2)  25579 (UI4)<br>282 (UI2)  96000 / 1000 (96) (URATIONAL)<br>283 (UI2)  96000 / 1000 (96) (URATIONAL)<br>296 (UI2)  2 (UI2)</p> <p align=left> </p></div></div> <p align=left> </p> <p align=left>Output from ExifTool:</p> <p align=left> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p align=left>ExifTool Version Number         : 7.45<br>File Name                       : output_5.tif<br>Directory                       : .<br>File Size                       : 25 kB<br>File Modification Date/Time     : 2008:11:18 14:02:37-08:00<br>File Type                       : TIFF<br>MIME Type                       : image/tiff<br>Exif Byte Order                 : Little-endian (Intel, II)<br>Subfile Type                    : Full-resolution Image<br>Image Width                     : 2960<br>Image Height                    : 1050<br>Bits Per Sample                 : 1<br>Compression                     : T6/Group 4 Fax<br>Photometric Interpretation      : WhiteIsZero<br>Fill Order                      : Unknown (0)<br>Strip Offsets                   : 8<br>Samples Per Pixel               : 1<br>Rows Per Strip                  : 1050<br>Strip Byte Counts               : 25579<br>X Resolution                    : 96<br>Y Resolution                    : 96<br>Resolution Unit                 : inches<br>Image Size                      : 2960x1050</p> <p align=left> </p></div></div> <p align=left> </p> <p></p> <p align=left> </p> <p></p> <p align=left> </p> <p align=left> </p>Fri, 07 Nov 2008 20:05:31 Z2009-09-07T03:28:43Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/23842b3c-7511-4f09-9e80-4e6a2b2eaeabhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/23842b3c-7511-4f09-9e80-4e6a2b2eaeabvickyalonehttp://social.msdn.microsoft.com/Profile/en-US/?user=vickyaloneWIC index suppoort failsWhen I tried to convert bmp file in to AIT format having black &amp; white option, and then use WICExplorer to open the same file . It opened succesfully. But when I tried to convert same bmp file in to &quot;8bpp indexed format&quot; it converted the file , but when try to open using WICexplorer, it fails to open having display same error &quot;WINCODEC_ERR_COMPONENTNOTFOUND&quot;. I am sured now my registry entry working fine, because same codec used for black &amp; white option and work fine . So if anybody faced the same issue earlier , please help me in it.<br/>Mon, 31 Aug 2009 07:29:40 Z2009-08-31T07:29:42Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/523836ef-e339-431d-ba0e-486336910a5ehttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/523836ef-e339-431d-ba0e-486336910a5evickyalonehttp://social.msdn.microsoft.com/Profile/en-US/?user=vickyaloneWIC decoder fails<p>Hi experts....<br/>                        I develoepd a sample &quot;abc&quot; image  Codec  using WIC in window XP (using Visual Studio 2008 profesisonal edition). I am able to encode the bmp image in to &quot;.abc&quot; file format. But when I tried to decode the same &quot;.abc&quot; file (generated using encoder) , I got the error &quot;WINCODEC_ERR_COMPONENTNOTFOUND&quot;. I succefully digitally signed the codec(dll). But enable to sort out the above error . If anybody work on the WIC codec before, then please help me for the same. I tried to debug the WICExplorer code and cam eto know the soucre of error and it was due to Funtion named '<span style="font-size:x-small">CreateDecoderFromFilename&quot; fails . But I don't know how to rectify the error. I am able to encode the file in to abc file format, But I am enable to decode the same .</span></p> <p><br/>Thanks ;<br/>Vikas</p>Wed, 26 Aug 2009 13:41:29 Z2009-08-28T08:42:49Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/f1e09f72-264c-4d0d-8344-4ce90f0fc67fhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/f1e09f72-264c-4d0d-8344-4ce90f0fc67fJesper Schmidthttp://social.msdn.microsoft.com/Profile/en-US/?user=Jesper%20SchmidtHow do I use the Microsoft build-in metadata providersHi,<br/><br/>I'm writing a raw codec. The fileformat is based on a tif format, but there is something in the format that IWICTiffDecoder cannot handle. The result is that the decoder does not contain any frames. And therefore i cannot get to the MetaDataBlockReader.<br/><br/> <pre>IWICBitmapFrameDecode* piTiffFrameDecoder = NULL; if (SUCCEEDED(hr)) hr = LOGERROR( CoCreateInstance(CLSID_WICTiffDecoder, NULL, CLSCTX_INPROC_SERVER, IID_IWICBitmapDecoder, (LPVOID*) &amp;m_piTiffDecoder)); if (SUCCEEDED(hr)) hr = LOGERROR( m_piTiffDecoder-&gt;Initialize( pIStream, WICDecodeMetadataCacheOnDemand )); UINT frameCount = 0; hr = LOGERROR( m_piTiffDecoder-&gt;GetFrameCount( &amp;frameCount )); if (SUCCEEDED(hr) &amp;&amp; frameCount &gt; 0 ) hr = LOGERROR( m_piTiffDecoder-&gt;GetFrame(0, &amp;piTiffFrameDecoder)); else hr = WINCODEC_ERR_FRAMEMISSING; </pre> <br/><br/>I get frame missing, when i pass my file through the above code, but the problem could be that it is a raw fileformat, and therefore the image data is not in rgb values or compressed in a non-standard way.<br/><br/><br/>Then I try to make my owne IWICMetaDataBlockReader implementation, and here is my question: How do i use the build in metadata handlers? For example the exif decoder.<br/><br/>I have tried to position the stream at the begining of the exif block, and created a metadata reader with IWICComponentFactory::CreateMetadataReader( CLSID_WICExifMetadataReader... and the result is a metadata reader, that contains 1 value of type BLOB.<br/><br/><br/>I have also tried to use IWICComponentFactory::CreateMetadataReaderFromContainer as described in the IWICMetaDataBlockReader section of &quot;How to write a WIC-Enabled Codec&quot; to enumerate the metadata blocks, withte same result.<br/><br/>I have quired the IWICPersistStream interface from the IWICMetadataReader, and called LoadEX, also with the same result, a BLOB. I never gets any HESULTS errors.<br/><br/>thanks<br/>Tue, 18 Aug 2009 07:34:43 Z2009-08-26T08:15:48Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e72a9e28-70b9-4462-a6a9-f5f0ebac248ahttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/e72a9e28-70b9-4462-a6a9-f5f0ebac248akpsinghhttp://social.msdn.microsoft.com/Profile/en-US/?user=kpsinghwincodecsdk.h removed in latest WinSDK ?<p>I upgraded to the latest WinSDK (for Win7, .NET 3.5 SP1), and found that a couple of projects fail to build as they were including &quot;wincodecsdk.h&quot;, which is now missing.<br/>I removed inclusion of the header in one project, and it seems that it wasn't really required there. But I'm wondering if that file is actually removed from the SDK, and if so, what's the migration path for someone who's using any of the APIs defined there ?</p>Mon, 24 Aug 2009 20:42:06 Z2009-08-24T20:42:06Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/9f5f5487-64f3-476d-b0de-c85c835e6ccchttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/9f5f5487-64f3-476d-b0de-c85c835e6cccCorne Loshttp://social.msdn.microsoft.com/Profile/en-US/?user=Corne%20LosHow to save TIFF CCITT G4 single strip using TiffBitmapEncoder ?Does anybody know how I can force the TiffBitmapEncoder to write TIFF CCITT Group4 in a single strip?<br/>The following code was working fine (i.e. it was producing single strip tiff's) until I ran it under Windows 7. It seems something has changed in Windows 7 causing my code to produce TIFF CCITT G4 files encoded with multiple strips.<span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small"> <p> </p> <pre>TiffBitmapDecoder decoder = new TiffBitmapDecoder(source, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); BitmapSource bitmapSource = decoder.Frames[0]; FileStream target = new FileStream(@&quot;d:\temp\test.tiff&quot;, FileMode.Create); TiffBitmapEncoder encoder = new TiffBitmapEncoder(); encoder.Compression = TiffCompressOption.Ccitt4; encoder.Frames.Add(BitmapFrame.Create(bitmapSource)); encoder.Save(target); target.Close();</pre> </span></span></span></span>Mon, 17 Aug 2009 12:11:45 Z2009-08-17T12:11:46Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/283ee988-3bef-4104-aa9b-a7a69c24b8a5http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/283ee988-3bef-4104-aa9b-a7a69c24b8a5Art_99999http://social.msdn.microsoft.com/Profile/en-US/?user=Art_99999Trying to supply a custom IStream to MS PNG decoder, getting QueryInterfaced for mysterious GUID and failingI've got a very simple IStream implementation that wraps around a blob of binary data in memory.  It works if I try to read a block of memory containing a JPG file using IWICImagingFactory::CreateDecoderFromStream.  However, if I try to read a block of memory containing a PNG file, it fails every time after attempting to QueryInterface with guid {C3933843-C24B-45A2-8298-B462F59DAAF2}.  I've searched the internet and our codebase for this GUID, and have found nothing. <div><br/></div> <div>When I return failure because I don't have a clue what this GUID is, my failure code is carried verbatim back through WindowsCodecs.dll back to my function that is trying to call IWICBitmapDecoder::Initialize.</div> <div><br/></div> <div><strong><span style="text-decoration:underline">Here is the code that gets executed (error handling omitted):</span></strong></div> <div>1: CoCreateInstance(CLSID_WICImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_IWICImagingFactory,(void**)&amp;cpFactory); // creates the factory (returns S_OK)</div> <div>2: cpFactory-&gt;CreateDecoder(GUID_ContainerFormatPng, NULL, &amp;cpDecoder); // creates my decoder.  I know this data is PNG data (returns S_OK)</div> <div>3: CComPtr&lt;CSimpleStream&gt; cpStream = new CSimpleStream((LPCBYTE)pvImage,cbImage); // wraps my CSimpleStream class around my block of data (returns valid pointer)</div> <div>4: cpDecoder-&gt;Initialize(cpStream, WICDecodeMetadataCacheOnDemand); // tries to make the decoder read my data (returns E_NOTIMPL)</div> <div><br/></div> <div><strong><span style="text-decoration:underline">Here are some facts:</span></strong></div> <div>1) Line 4 will return whatever HRESULT value I return in my CSimpleStream::QueryInterface call, which is what makes me think I need to know what this GUID is since me not being able to supply it is apparently causing everything to fail.</div> <div>2) The _only_ method on my IStream that gets called is QueryInterface.  It doesn't even get a chance to Read() my data, Seek(), or get Stat(), so whether my data is valid or whether my implementation beyond QueryInterface is correct is seemingly irrelevant.</div> <div>3) My data is valid.  I'm replacing another PNG parser with WIC because it is supposed to be faster and less buggy, and it worked fine with the same data</div> <div>4) My implementation appears to be valid, because I've already used it for reading JPGs with WIC</div> <div>5) My windowCodecs.dll module is version 6.0.6001.18000</div> <div><br/></div> <div><strong><span style="text-decoration:underline">Here is the callstack resolved from WindowsCodecs.dll when it queries me for this GUID:</span></strong></div> <div> <div>MyApp.exe!CSimpleStream::<strong>QueryInterface</strong>(const _GUID &amp; riid={...}, void * * ppif=0x02427338)  Line 38<span style="white-space:pre"> </span>C++</div> <div>WindowsCodecs.dll!<strong>HrStreamBaseFromIStream</strong>()  + 0x2c bytes<span style="white-space:pre"> </span></div> <div>WindowsCodecs.dll!<strong>CCodecBase::HrInit</strong>()  - 0x23b7f bytes<span style="white-space:pre"> </span></div> <div>WindowsCodecs.dll!<strong>CDecoderBase::HrInit</strong>()  + 0x1c bytes<span style="white-space:pre"> </span></div> <div>WindowsCodecs.dll!<strong>CGpPngDecoder::HrInit</strong>()  + 0x10 bytes<span style="white-space:pre"> </span></div> <div>WindowsCodecs.dll!<strong>CDecoderBase::Initialize</strong>()  + 0x73 bytes<span style="white-space:pre"> </span></div> <div>MyApp.exe!GetDecoderFromStream(...params...)  Line 349 + 0x26 bytes<span style="white-space:pre"> </span>C++</div> <div><br/></div> </div> <div><br/></div> <div>So... does anyone know what {C3933843-C24B-45A2-8298-B462F59DAAF2} is?</div>Thu, 13 Aug 2009 20:07:52 Z2009-08-14T15:58:35Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/d193bce7-0894-4d6a-9ded-cfa0e7e2970ehttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/d193bce7-0894-4d6a-9ded-cfa0e7e2970eArne Madsenhttp://social.msdn.microsoft.com/Profile/en-US/?user=Arne%20MadsenWIC vs Microsoft Pro photo tools 2 - gps positionsHi,<br/>If I geocode a position with MS pro photo tools 2, and read the gps metadata with wic explorer (64-bit) the results differ a bit.<br/>Which one should I trust?<br/>e.g.<br/>Pro photo: latitude = 3 23' 34,05&quot; <br/>WIC = 3 deg. 23,57'<br/><br/>Regards<br/>ArneThu, 18 Jun 2009 11:49:51 Z2009-08-14T12:10:42Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/24316203-3144-494e-857d-68d618e02766http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/24316203-3144-494e-857d-68d618e02766pariamithttp://social.msdn.microsoft.com/Profile/en-US/?user=pariamitGetting app (Windows Photo Gallery ) to use the same aitcodec.dll<p align=left><font face=Arial size=2></font> </p> <p>My question might be trivial to some but I am a first timer for WIC. Is there anything special that I need to do for the Windows Photo Gallery ot WIC Explorer to use the aitcodec.dll ?</p> <p align=left>the aitcodec.dll has been registered fine..</p> <p align=left> </p> <p align=left>However I cant get it to load when using Windows Photo Gallery for all the formats that I have tried...neither with WIC explorer when trying to encode...I have tried bmp, gif, png all possible formats...</p> <p align=left>does it read only a specific for,mat( for decode) and does it write only to a specific format( for encode )?</p> <p align=left> </p> <p align=left>Any help appreciated.</p> <p align=left> </p> <p align=left>Thanks.</p>Thu, 13 Nov 2008 19:06:45 Z2009-08-11T06:28:40Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/c96a69d3-cf4f-4417-b694-9a9c288a6c20http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/c96a69d3-cf4f-4417-b694-9a9c288a6c20diabolic1134http://social.msdn.microsoft.com/Profile/en-US/?user=diabolic1134JpegBitmapEncoder<font size=2><span style="font-family:Arial">I've noticed something odd with resizing JPG's. If you run the following code, the file size for a quality level of 75 doesn't seem to be correct when compared to better quality output on the JpegBitmapEncoder. I've tried this with a dozen or so JPG's to verify this wasn't just one particular JPG.<br></span></font><br>static void Main(string[] args)<br>{<br>   for (int i = 0; i &lt; 10; i++)<br>      ResizeJpg(i + 70);<br>}<br><br>private static void ResizeJpg(int qualityLevel)<br>{<br>    using (FileStream fileStream = new FileStream(@&quot;c:\test.jpg&quot;, FileMode.Open, FileAccess.Read))<br>    {<br>    BitmapImage image = new BitmapImage();<br>    image.BeginInit();<br>    image.StreamSource = fileStream;<br>    image.DecodePixelWidth = 600;<br>    image.CreateOptions = BitmapCreateOptions.None;<br>    image.CacheOption = BitmapCacheOption.None;<br>    image.EndInit();<br><br>    JpegBitmapEncoder encoder = new JpegBitmapEncoder();<br>    encoder.QualityLevel = qualityLevel;<br>    encoder.Frames.Add(BitmapFrame.Create(image));<br><br>    using (FileStream saveFileStream = new FileStream(@&quot;c:\test_output.jpg&quot;, FileMode.Create, FileAccess.Write))<br>    {<br>            encoder.Save(saveFileStream);<br>    }<br>    }<br>    FileInfo fileInfo = new FileInfo(@&quot;c:\test_output.jpg&quot;);<br>    Console.WriteLine(&quot;Quality: {0}, Filesize: {1}kb&quot;, qualityLevel, (fileInfo.Length / 1024f));<br>}<br> <div style="text-align:left"><br></div><font size=2><span style="font-family:Arial"></span></font><font size=2><span style="font-family:Arial"><span style="font-weight:bold">Here are the results of my tests:</span><br>Quality: 70, Filesize: 33.98047kb<br>Quality: 71, Filesize: 34.99121kb<br>Quality: 72, Filesize: 36.12988kb<br>Quality: 73, Filesize: 37.04199kb<br>Quality: 74, Filesize: 38.15918kb<br><span style="background-color:rgb(255,255,0)">Quality: 75, Filesize: 66.51563kb</span><br>Quality: 76, Filesize: 38.38965kb<br>Quality: 77, Filesize: 39.38672kb<br>Quality: 78, Filesize: 41.07227kb<br>Quality: 79, Filesize: 42.98535kb<br><br>Is this a known issue?<br></span></font>Wed, 15 Oct 2008 00:51:34 Z2009-08-03T17:00:05Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/55435af3-21f9-40c7-a2ba-120be48580fehttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/55435af3-21f9-40c7-a2ba-120be48580fem_livehttp://social.msdn.microsoft.com/Profile/en-US/?user=m_liveCopy Metadata Between FormatsDoes anyone know of a good way to copy <em>all</em> metadata from one type of image (CR2/NEF) to another type of image (JPEG/TIFF)? The solution can be complicated and in any language - it just has to work!<br/> <br/> [Background]<br/> I have been building a piece of software to manage/display images. Though currently based on GDI+ I have ventured into the world of WIC in order to add support for RAW codecs. The problem is - RAW codecs take quite a while to load and display so I require the user to convert to JPG/TIFF before using the images. When I perform this conversion all of the metadata from the RAW files is lost (clearly). After lots and lots of searches I cannot seem to come up with any good solutions for copying the metadata from one type of image (CR2 or NEF for example) to another type of image (JPEG).<br/> <br/> [Previous Steps]<br/> The following are a few things I have looked at or tried. These aren't solutions to my problem but might help others who have something simpler but similar:<br/> <ul> <li>If encoding an image from one file to another file of the SAME type (http://msdn.microsoft.com/en-us/library/bb531153(VS.85).aspx)</li> <li>Tried calling &quot;CreateQueryWriterFromReader&quot;, then writing the blocks. The inital create writer from reader failed!</li> <li>I couldn't find any reasonable [WIC] code to enumerate or list all metadata in a file or even inside of an IFD</li> <li>I would be happy to write code to copy tags by hand but I can't find any list of all tags except at cpan and the list was so long it was quite discouraging. Additionally I would have to manually program the conversions between each of the types.</li> </ul> I looked for alternate libraries but none of them support RAW file types which is why I am using WIC in the first place.<br/> <br/> If you need further information or code examples please let me know and I will be happy to provide them. Thanks in advance!Wed, 22 Jul 2009 01:19:35 Z2009-07-31T17:41:52Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/7011d40b-58d6-4198-a077-a007e4079cd3http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/7011d40b-58d6-4198-a077-a007e4079cd3ilohihttp://social.msdn.microsoft.com/Profile/en-US/?user=ilohiRecovering CD digital imagesHow can I extract and open JPEG digital photography files from a stubbord CD that won't allow me to open them?<br/>The files are listed as icons when I open the CD in Windows Explorer, but they do not preview or open no matter what I do.  <br/>Do I need a Windows imaging component (WIC)?  If so, which one?<br/>Is it something to do with decoding the images?Fri, 31 Jul 2009 08:33:08 Z2009-07-31T08:33:08Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/b88b2f45-b56b-4215-8f6b-42addba69a78http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/b88b2f45-b56b-4215-8f6b-42addba69a78Wintercasehttp://social.msdn.microsoft.com/Profile/en-US/?user=WintercaseWindows 7 WIC Policy has changed. Where is the documentation?<p>So I installed Win7 and ran up the unit tests on my application.  A bunch of tests are failing<br/><br/>For an image with the following metadata:<br/>/app13/{ushort=0}/{ulonglong=61857348781060}/iptc/{str=Headline}, /{str=Headline}:this is the title<br/>/app13/{ushort=0}/{ulonglong=61857348781060}/iptc/{str=Caption}, /{str=Caption}:this is the description<br/>/app13/{ushort=0}/{ulonglong=61857348781060}/iptc/{str=Object Name}, /{str=Object Name}:this is the title<br/><br/>Querying using System.Title Policy in WIC on Win7 has changed. Results are now:<br/>Win XP, Vista: this is the title<br/>Win7: this is the description<br/><br/>Obviously the mappings have changed. Is there any update in documentation for this?<br/>The only reference I could find was this:<br/><br/><a href="http://msdn.microsoft.com/en-us/library/dd408864(VS.85).aspx">http://msdn.microsoft.com/en-us/library/dd408864(VS.85).aspx</a><br/><em>In Windows 7, the photo metadata handler and the metadata policy layer have been updated to read and write image metadata according to the guidelines established by the MWG. For more information on the Metadata Working Group (MWG) and the established metadata guidelines, visit the Metadata Working Group Web site.<br/><br/></em>This is a pretty significant change. Is there more extensive documentation than this?</p> What is the user story for people who have used WLPG or Vista Photo gallery to do edits with the old policy? <hr class=sig> CSun, 14 Jun 2009 11:45:10 Z2009-07-28T20:40:51Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/84fac1d1-63a6-4079-a681-53028d9139a1http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/84fac1d1-63a6-4079-a681-53028d9139a1Rodlinghttp://social.msdn.microsoft.com/Profile/en-US/?user=Rodlingcan not finf Robert Wlodarczyk source for Using WPF's InPlaceBitmapMetadataWriter link bad<p>Can not find the code refrence here, need it badly. Does anybody have it or a good link?<br/>If you've struggled with the InPlaceBitmapMetadataWriter and want to get the sample... <a title="Using InPlaceBitmapMetadataWriter" href="http://www.rawweb.net/samples/UsingInPlaceBitmapMetadataWriter.zip">grab it from here</a>.<a href="http://www.rawweb.net/samples/UsingInPlaceBitmapMetadataWriter.zip"><br/><br/>http://www.rawweb.net/samples/UsingInPlaceBitmapMetadataWriter.zip</a><br/>Robert Wlodarczyk<br/><span class=entrylistheader><a href="http://social.msdn.microsoft.com/rwlodarc/archive/2007/07/18/using-wpf-s-inplacebitmapmetadatawriter.aspx">Using WPF's InPlaceBitmapMetadataWriter</a><br/></span></p>Tue, 28 Jul 2009 15:59:46 Z2009-07-28T15:59:46Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/2708fa5e-3e9b-4c1c-9cc4-56eda7b4cdc2http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/2708fa5e-3e9b-4c1c-9cc4-56eda7b4cdc2Giladkhttp://social.msdn.microsoft.com/Profile/en-US/?user=GiladkPreviewing WMP files while downloading themHello.<br/> <br/> I would like to load a WMP file to a WPF client from a server. <br/> I read that this format can preview data while the image is being downloaded, a preview that gets better and better as more data is downloaded.<br/> <br/> I tried to simulate this with a very simple WPF application:<br/> <pre lang="x-c#">private void button1_Click(object sender, RoutedEventArgs e) { MemoryStream MS = new MemoryStream(); int read = 0; byte[] buffer = new byte[4*1024]; // 4k buffer FileStream FS = new FileStream(@&quot;E:\Im.wdp&quot;, System.IO.FileMode.Open); WmpBitmapDecoder Dec = new WmpBitmapDecoder(MS, BitmapCreateOptions.DelayCreation, BitmapCacheOption.OnDemand); while (true) { read = FS.Read(buffer, 0, buffer.Length); // read from the file if (read == 0) break; // EOF MS.Write(buffer, 0, buffer.Length); // write to the memory ImageSource Prev = null; try { Prev = Dec.Preview; } catch { // Throws an exception... } if (Prev != null) { image1.Source = Dec.Preview; // image1 is the Image object } } MS.Flush(); image1.Source = Dec.Frames[0]; }</pre> Obviously, the above code fails...<br/> <ol> <li>Why can't I create an instance on WmpBitmapDecoder with an empty stream? If i read ~16 bytes to the memory stream before creating the instance it seems to work.</li> <li>Documentation states that is Preview doesn't exists then null is returned. I keep getting an exception and not null; </li> </ol> Any ideas what I'm I doing wrong?<br/> <br/> thanks for your help<br/> <br/> Gilad.<br/> <br/> <br/> <br/> <br/>Thu, 23 Jul 2009 13:53:27 Z2009-07-23T13:53:27Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/5e1b4626-216f-46d6-8cc2-8efd2e861407http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/5e1b4626-216f-46d6-8cc2-8efd2e861407Rodlinghttp://social.msdn.microsoft.com/Profile/en-US/?user=RodlingWhere do I look for help using VB.net to access vista WMP shared media WMPNSSI am trying to write a slidshow type application that will get its pictured from the WMP vista media server sevices. Can not figure out whre to start or get help.<br/><br/>Thanks<br/><br/>Wed, 22 Jul 2009 17:32:06 Z2009-07-22T17:32:07Zhttp://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/2112486d-26db-47b6-b722-a537a11541e6http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/2112486d-26db-47b6-b722-a537a11541e6rpetheshttp://social.msdn.microsoft.com/Profile/en-US/?user=rpethesUsing memory stream to encode targetHi!<br><br>I would like to use WIC to encode images not between files, but from a memory buffer, to an other memory buffer. To obtain this, a created the target stream with the <i>InitalizeFromMemory </i>method like this:<br><br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px">[...] </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)"> </td></tr><tr><td>if (SUCCEEDED(result)){      </td></tr><tr><td style="background-color:rgb(247, 247, 247)"> <font style="color:red">result</font><font style="font-size:11px"> = </font><font style="color:blue">_piFactory</font><font style="font-size:11px">-</font><font style="color:blue">&gt;</font><font style="font-size:11px">CreateStream(&amp;piStream); </font></td></tr><tr><td>} </td></tr><tr><td style="background-color:rgb(247, 247, 247)"> </td></tr><tr><td>if (SUCCEEDED(result)) </td></tr><tr><td style="background-color:rgb(247, 247, 247)">{ </td></tr><tr><td>   // targetBuffer is a pre-alloceted memory buffer </td></tr><tr><td style="background-color:rgb(247, 247, 247)">   <font style="color:red">result</font><font style="font-size:11px"> = </font><font style="color:blue">_piStream</font><font style="font-size:11px">-</font><font style="color:blue">&gt;</font><font style="font-size:11px">InitializeFromMemory(targetBuffer,targetBufferSize); </font></td></tr><tr><td>} </td></tr><tr><td style="background-color:rgb(247, 247, 247)"> </td></tr><tr><td>[...] </td></tr></tbody></table></div><br>My question: when the encoding process is ready, what is the legal way to receive the size of the result image in the memory buffer ?<br><br>Thanks!<br><br><br> Tue, 24 Feb 2009 13:18:23 Z2009-07-21T19:45:49Z