Howto use OpacityMask and Images
I have an image with a white background. Please tell me if I can use the OpacityMask for that image to make the white background transparent.
This shows nothing:
<Image Canvas.Top="3" Source="images\Journals.png" x:Name="journals_Image" Width="32" Height="32">
<Image.OpacityMask>
<SolidColorBrush Color="White" Opacity="0" />
</Image.OpacityMask>
</Image>
Thanks,
Michael S. Scherotter
An opacityMask takes the alpha channel of the brush object assigned to it and applies that to the containing object (the Image tag in your case). In your example above, the brush has opacity zero and therefore your image does not show.
You could apply an ImageBrush to the OpacityMask property of your Image, but that would not give you the behavior you are looking for: it would apply the alpha channel of ImageBrush.ImageSource to your original Image tag. There is currently no way of saying: apply any white pixels as the opacity mask to this other image.
Thanks,
Ed Maia
WPF/E Program Manager