How to decode tiff file and preserve opacity?<span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"> <p class=MsoNormal style="margin:0cm 0cm 10pt"><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">By default, standard TiffBitmapDecoder decodes to flatten image with white background. </span></span></span></span><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">All transparency converts to white. But if I save in Photoshop file in tiff format, with not recently used option, &quot;Save Transparency&quot;, </span></span></span></span><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">TiffBitmapDecoder converts fine and preserve opacity.</span></span></span></span></p> <span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"> <p class=MsoNormal style="margin:0cm 0cm 10pt"><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">I need solution, how I can import all tiff files and preserve opacity, or how I can read alpha chanel or mask information from file to have ability add Opacity.Mask to Image?</span></span></span></span></p> </span></span></span></span><span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af"> <p class=MsoNormal style="margin:0cm 0cm 10pt"> </p> </span></span></span><span style="font-family:Consolas;color:#2b91af"> <p class=MsoNormal style="margin:0cm 0cm 10pt"> </p> </span></span> <p class=MsoNormal style="margin:0cm 0cm 10pt"> </p>© 2009 Microsoft Corporation. All rights reserved.Tue, 07 Jul 2009 20:46:14 Z78ae0f1d-28a5-4fbf-89ce-97f2cccad826http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#78ae0f1d-28a5-4fbf-89ce-97f2cccad826http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#78ae0f1d-28a5-4fbf-89ce-97f2cccad826silverwebhttp://social.msdn.microsoft.com/Profile/en-US/?user=silverwebHow to decode tiff file and preserve opacity?<span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"> <p class=MsoNormal style="margin:0cm 0cm 10pt"><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">By default, standard TiffBitmapDecoder decodes to flatten image with white background. </span></span></span></span><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">All transparency converts to white. But if I save in Photoshop file in tiff format, with not recently used option, &quot;Save Transparency&quot;, </span></span></span></span><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">TiffBitmapDecoder converts fine and preserve opacity.</span></span></span></span></p> <span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"> <p class=MsoNormal style="margin:0cm 0cm 10pt"><span lang=EN-US><span style="font-size:small"><span style="color:#000000"><span style="font-family:Calibri">I need solution, how I can import all tiff files and preserve opacity, or how I can read alpha chanel or mask information from file to have ability add Opacity.Mask to Image?</span></span></span></span></p> </span></span></span></span><span style="font-family:Consolas;color:#2b91af"><span style="font-family:Consolas;color:#2b91af"> <p class=MsoNormal style="margin:0cm 0cm 10pt"> </p> </span></span></span><span style="font-family:Consolas;color:#2b91af"> <p class=MsoNormal style="margin:0cm 0cm 10pt"> </p> </span></span> <p class=MsoNormal style="margin:0cm 0cm 10pt"> </p>Fri, 03 Jul 2009 20:37:43 Z2009-07-04T12:06:03Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#becbb77a-524a-427f-a47d-ccff8a4c811chttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#becbb77a-524a-427f-a47d-ccff8a4c811cMark Salsberyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Mark%20SalsberyHow to decode tiff file and preserve opacity?Are you using the &quot;<span class=selflink>PreservePixelFormat</span>&quot; create option on the TiffBitmapDecoder?<br/><hr class="sig"> Mark Salsbery Microsoft MVP - Visual C++ Sat, 04 Jul 2009 20:58:02 Z2009-07-04T20:58:02Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#c69da743-64c0-4aef-aef6-0f47e1a0b3f3http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#c69da743-64c0-4aef-aef6-0f47e1a0b3f3silverwebhttp://social.msdn.microsoft.com/Profile/en-US/?user=silverwebHow to decode tiff file and preserve opacity?<blockquote>Are you using the &quot;<span class=selflink>PreservePixelFormat</span>&quot; create option on the TiffBitmapDecoder?<br/> <hr class=sig> Mark Salsbery Microsoft MVP - Visual C++</blockquote> <br/>Yes, but same result for <span style="font-family:Consolas;color:#2b91af;font-size:x-small"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"><span style="font-family:Consolas;color:#2b91af;font-size:x-small"><span style="font-family:Consolas;color:#2b91af;font-size:x-small">BitmapCreateOptions</span></span></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"><span style="color:#000000">.None<br/><br/> <pre lang="x-c#">Stream imageStreamSource = new FileStream(&quot;C:/Users/*/*.tif&quot;, FileMode.Open, FileAccess.Read, FileShare.Read); TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); BitmapSource bitmapSource = decoder.Frames[0]; testImage.Source = bitmapSource;</pre> </span></span></span></span></span></span>Sun, 05 Jul 2009 11:41:59 Z2009-07-05T11:43:21Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#25b01345-a9a0-4218-8eed-7ed2463e23fahttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#25b01345-a9a0-4218-8eed-7ed2463e23faJordan Parker - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Jordan%20Parker%20-%20MSFTHow to decode tiff file and preserve opacity?<p>Eric from the WIC team says this:<br/><br/>&quot;The problem is that, when Photoshop saves a TIFF file, it handles alpha by using custom metadata which stores Photoshop’s proprietary layer information. If “save layers” is turned off, even Photoshop won’t recognize that the saved image has alpha.</p> <p>The most standard way to support alpha in a TIFF file is to use an extra sample representing the alpha channel. By default, Photoshop doesn’t write this sample, so WIC has no good way of detecting that the image includes alpha. If the “Save transparency” option is checked in Photoshop, it will write the alpha channel, in which case WIC should recognize and display the alpha properly.</p> <p>Given that Adobe’s default way of saving alpha is proprietary and based on the Photoshop layer system, most applications won’t detect the TIFF’s alpha unless the “Save transparency” option is checked (I confirmed with IrfanView, Picassa didn’t seem to support TIFF transparency).&quot;<br/><br/>You need to use &quot;save transparency.&quot;</p>Mon, 06 Jul 2009 23:31:24 Z2009-07-06T23:31:24Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#f76d04e6-285a-40e8-bb4a-2cb96cfe58c9http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/78ae0f1d-28a5-4fbf-89ce-97f2cccad826#f76d04e6-285a-40e8-bb4a-2cb96cfe58c9silverwebhttp://social.msdn.microsoft.com/Profile/en-US/?user=silverwebHow to decode tiff file and preserve opacity?Thanks a lot for reply, it's helpful information for me. <br/>tnxTue, 07 Jul 2009 20:45:27 Z2009-07-07T20:45:27Z