Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Web Multimedia
Procedural Surfaces
 AlphaImageLoader Filter
AlphaImageLoader Filter

Displays an image within the boundaries of the object and between the object background and content, with options to clip or resize the image. When loading a Portable Network Graphics (PNG) image, tranparency from zero to 100 percent is supported.

Syntax

HTML
<ELEMENT STYLE=
"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sProperties)"
... >
Internet Explorer 5.5 or later
Scripting
object.style.filter =
"progid:DXImageTransform.Microsoft.AlphaImageLoader(sProperties)"
Internet Explorer 5.5 or later

Possible Values

sPropertiesString that specifies one or more properties exposed by the filter.

Members Table

The following table lists the members exposed by the AlphaImageLoader object.

Attributes/Properties
Show:
AttributePropertyDescription
enabledEnabled Sets or retrieves a value that indicates whether the filter is enabled.
sizingMethodsizingMethod Sets or retrieves the manner in which to display an image within the boundary of the object that the AlphaImageLoader filter is applied to.
srcsrc Sets or retrieves the URL of an image that the AlphaImageLoader filter loads.

Remarks

The src property has no default and must be defined for this filter to affect the object's display.

Transparency for PNG images is respected during text selection. This means the user can select content that is displayed behind the fully transparent region of a PNG image.

The object that the filter is applied to must have layout before the filter effect will display. You can give the object layout by setting the height or width property, setting the position property to absolute, setting the writingMode property to tb-rl, or setting the contentEditable property to true.

In standards mode, empty div elements do not display. If your filtered elements do not show up, make sure you set the div's height and width property to the size of your image, or fill the div with a non-breaking space (&nbsp;). You can test your page under different document modes by using the Developer Tools on Windows Internet Explorer 8.

You can assign multiple filters or transitions to an object by declaring each in the filter property of the object. The following div declaration assigns two filters and a Wheel transition to a div element.

<DIV STYLE="width:100%; filter:
    progid_DXImageTransform.Microsoft.MotionBlur(strength=13, direction=310)
    progid_DXImageTransform.Microsoft.Blur(pixelradius=2)
    progid_DXImageTransform.Microsoft.Wheel(duration=3);">
        Blurry text with smudge of gray.</div>     
When multiple filters are applied to an object, each filter is processed in source order, with the exception of procedural surfaces, which are computed first. To emphasize a filter's effect, place it last in source order or on the object's parent. Always place transitions last in source order.

Examples

Click the button below to view a demonstration of the advantages of using the AlphaImageLoader filter to display PNG images over that of GIF images.

This feature requires Microsoft Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

The following example loads a div element with an image expanded to a 250-pixel square and then uses the sizingMethod property to change between the default, 100-pixel size and the expanded, 250-pixel size. The filters collection is used to reference the div element's filter properties.

<SCRIPT>
var bToggle = 1

<!-- Toggle the sizingMethod property to resize the image.  -->
function fnToggle(oObj) {
    if (bToggle) {                                                        
        bToggle = 0;
        oDiv.filters(0).sizingMethod="image";
        oObj.innerText='Enlarge It';}
    else {
        bToggle = 1;
        oDiv.filters(0).sizingMethod="scale";
        oObj.innerText='Make Normal';}
}
</SCRIPT>
        
<!-- This DIV is the target container for the image.  -->        
    <DIV ID="oDiv" STYLE="position:relative; height:250px; width:250px;         
        filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
            src='/workshop/graphics/earglobe.gif', sizingMethod='scale');" >
        </DIV>

<BR><BUTTON onclick="fnToggle(this);">Make Normal</BUTTON>

This feature requires Microsoft Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Applies To

A, ABBR, ACRONYM, ADDRESS, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, FRAME, hn, IFRAME, I, INS, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LEGEND, LI, MARQUEE, MENU, NOBR, OL, OBJECT, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TEXTAREA, TH, TD, TT, U, UL, VAR, XMP
Community Content   What is Community Content?
Add new content RSS  Annotations
Only affected to background images      jpvliet86   |   Edit   |   Show History
This fix only works for background images
For img tags you can use a JavaScript
anyway      papst   |   Edit   |   Show History
userxyz is right. Why the f*!/ing heck are you rejecting to support png24 easily?! It's hard enough for designers to get over the developing stuff and you are forcing them to cope with that junk!
Tags What's this?: Add a tag
Flag as ContentBug
Catch 22 for cross browser      Alphateck ... Thomas Lee   |   Edit   |   Show History

Actually here is a better use of the AlphaImageLoader fix that would avoid the use of conditional statements for use with crossbrowser support(as well as cross version for IE 5.5 and up)

Keep in mind that I replaced the open/close characters for tags "<>" with "@" symbols so that I can plug in this span and img tags into this comment area. The tag input field for this forum butchers my example. Just replace the "@" symbols with the correct open/close tag character.

"@span style="position: absolute; z-index: 100; left: 500px; top: 100px; width: 420px; display: inline-block; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/photoStack.png',sizingMethod='scale');"@@img style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="images/photoStack.png" width="420" border="0"@@/span@"

You have to ensure there are no spaces between the span and image tags. The width (and height if it is used) declarations must be the same in both the span and image tags. The size adjusting attributes must be present in both tags. As you can see, you only need to use positioning attributes in the span tag.

Tags What's this?: Add a tag
Flag as ContentBug
This is crazy      sondano ... Thomas Lee   |   Edit   |   Show History
Why doesn't IE have native support for PNG like Opera, Safari or FF?
Why do you have to be - almost - always different and - almost - always worse?


"Any fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction."
Albert Einstein
Flag as ContentBug
png file created by a script like php in src attribute      jasminam   |   Edit   |   Show History
Can src attribute in filter:progid:DXImageTransform.Microsoft.AlphaImageLoader have png file created by a script like php which does not have a png file url but a script url? 

I tried this, but the filter does not seem to be applied correctly, the whole image becomes white.
Flag as ContentBug
AlphaImageLoader on https sites?      azureel ... Thomas Lee   |   Edit   |   Show History

I tried https://example.com/try.htm but transparency did not work. Any workaround for this?

[tfl - 10 08 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at

http://www.microsoft.com/communities/newsgroups/en-us/ . You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C &
SQL Server :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C &
.NET Framework :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1

Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker