views:

10795

answers:

9

I'm using CSS Filters to modify images on the fly within the browser. These work perfectly in Internet Explorer, but aren't supported in Firefox.

Does anyone know what the CSS Filter equivalent for these is for Firefox? An answer that would work cross browser (Safari, WebKit, Firefox, etc.) would be preferred.

<style type="text/css">
    .CSSClassName {filter:Invert;}
    .CSSClassName {filter:Xray;}
    .CSSClassName {filter:Gray;}
    .CSSClassName {filter:FlipV;}
</style>

Update: I know Filter is an IE specific feature. Is there any kind of equivalent for any of these that is supported by Firefox?

+2  A: 

There are no equivalents in other browsers. The closest you could get is using a graphics library like Canvas and manipulating the images in it, but you'd have to write the manipulations yourself and they'd require JavaScript.


filter is an IE-only feature -- it is not available in any other browser.

John Millikin
Yes, I know Filter is an IE specific feature. That's why I'm asking if there is any kind of equivalent that works in Firefox.
Chris Pietschmann
A: 

None that I know of. Filter was an IE only thing and I don't think any other browser has followed with similar functionality.

What is there a specific use case you need?

Geoff
A: 

I'm afraid that you are pretty much out of luck with most of the cross-browser filter-type functionality. CSS alone will not allow you to do most of these things. For example, there is no way to invert an image cross-browser just using CSS. You will have to have two different copies of the image (one inverted) or you could try using Javascript or maybe go about it a completely different way, but there is no simple solution solely in CSS.

Steven Oxley
A: 

Not really, and hopefully there never will be. It's not a web standard CSS feature for the reason that you're using CSS to format the webpage, not the browser itself. The day that other web designers and developers think they should style my browser how they wish and are then do so is the day I stop visiting their pages (and I say this as a front end web guy).

superfireydave
filters don't style the browser.
Geoff
Oh right, I've gone off on a tangent here as the browser (i.e. scroll bar colour etc) styles are also to my knowledge IE specific and are similarly implemented to filters.I apologise and blame it on the 2 hours of sleep :<
superfireydave
+5  A: 

Could you give us a concrete example of what exactly you're trying to do? You'd probably get fewer "Your brower sux" responses and more "How about trying this different approach?" ones.

Normally CSS is used to control the look and feel of HTML content, not add effects or edit images in clever ways. What you're trying to do might be possible using javascript, but a behavior-oriented script still probably isn't very well suited for the kind of tweaking you want to do (although something like this is a fun and very inefficient adventure in CSS / JS tomfoolery).

I can't imagine a scenario when you would need the client to perform image tweaking in real-time. You could modify images server-side and simply reference these modified versions with your CSS or possibly Javascript, depending on what you're doing exactly. ImageMagick is a great little command-line tool for all the image effects you would ever need, and is pretty simple to use by itself or within the server-side language of your choice. Or if you're using PHP, I believe PHP's GD library is pretty popular.

Rudi
+4  A: 

Please check the Nihilogic Javascript Image Effect Library:

  • supports IE and Fx pretty well
  • has a lot of effects

You can find many other effects in the CVI Projects:

Good Luck

Andre Bossard
A: 

There are filters, such as Gaussian Blur et al in SVG, which is supported natively by most browsers except IE.

Pure thought experiment here, you could wrap your images in an SVG object on the fly with javascript and attempt to apply filters to them.

I doubt this would work for background images, though perhaps with alot of clever positioning it could work.

It's unlikely to be a realistic solution. If you don't want to permanently modify your source images, Rudi has the best answer, using server side tools to apply transformations on the fly (or cached for performance) will be the best cross browser solution.

garrow
A: 

How about using SVG in firefox?

Ed Haber
A: 

SVG filters applied to HTML content.

Only works in Firefox 3.1 and above, though I think Safari is heading in the same direction.

Ant P.