Page 1 of 4 123 ... LastLast
Results 1 to 10 of 35

Thread: Grayscale Effect with CSS on other browsers beside IE

  1. #1
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default Grayscale Effect with CSS on other browsers beside IE

    I'd like to make the same grayscale effect on IE compatiable with FireFox. Any ideas?
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Is that a filter?
    Not compatible.

    I don't know if there is another way.

    It's not that hard to just take an image and make it greyscale in most any graphics application, or you could even use the PHP GD library, if you must have it dynamically generated.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it isn't possible (without Flash, Java, &c.).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    How would you do it with PHP?
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Check this out, maybe:
    (From http://us3.php.net/manual/en/functio...ymergegray.php )
    To convert the picture to grayscale, use the following code:
    PHP Code:
    <?php
       
    // replace with your files
       
    $originalFileName    "colorPicture.jpg";
       
    $destinationFileName "bwPicture.jpg";
      
       
    // create a copy of the original image
       // works with jpg images
       // fell free to adapt to other formats ;)
       
    $fullPath explode(".",$originalFileName);
       
    $lastIndex sizeof($fullPath) - 1;
       
    $extension $fullPath[$lastIndex];
       if (
    preg_match("/jpg|jpeg|JPG|JPEG/"$extension)){
           
    $sourceImage imagecreatefromjpeg($originalFileName);
       }

       
    // get image dimensions
       
    $img_width  imageSX($sourceImage);
       
    $img_height imageSY($sourceImage);

       
    // convert to grayscale
       // note: this will NOT affect your original image, unless
       // originalFileName and destinationFileName are the same
       
    for ($y 0$y <$img_height$y++) {
           for (
    $x 0$x <$img_width$x++) {
               
    $rgb imagecolorat($sourceImage$x$y);
               
    $red  = ($rgb >> 16) & 0xFF;
               
    $green = ($rgb >> 8)  & 0xFF;
               
    $blue  $rgb 0xFF;

               
    $gray round(.299*$red .587*$green .114*$blue);
              
               
    // shift gray level to the left
               
    $grayR $gray << 16;  // R: red
               
    $grayG $gray << 8;    // G: green
               
    $grayB $gray;        // B: blue
              
               // OR operation to compute gray value
               
    $grayColor $grayR $grayG $grayB;

               
    // set the pixel color
               
    imagesetpixel ($sourceImage$x$y$grayColor);
               
    imagecolorallocate ($sourceImage$gray$gray$gray);
           }
       }

       
    // copy pixel values to new file buffer
       
    $destinationImage ImageCreateTrueColor($img_width$img_height);
       
    imagecopy($destinationImage$sourceImage0000$img_width$img_height);

       
    // create file on disk
       
    imagejpeg($destinationImage$destinationFileName);
      
       
    // destroy temp image buffers
       
    imagedestroy($destinationImage);   
       
    imagedestroy($sourceImage);
    ?>
    Copy-paste, replace the file names on the top and there you go (picture files must be in same folder as this script. If not, you will have to do your own file management).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    I mean, making the WHOLE PAGE grayscale (just like when you click Logout in these forums when using IE)
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah. HTML, etc?

    Interesting.

    I'm not sure.

    I'm not seeing anything in IE when I log out. Or FF, for that matter.

    The way, I suppose, would be to fade/switch to greyscale CSS, Images, etc.

    Depending on the purpose, you could just create alternate CSS, use when needed, and be done with it.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Have you tried clicking Logout on the menu?

    It will ask for a confirmation as well as grayscaling the screen.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can overlay a semi-transparent element over the page, which will result in the same sort of effect if the user's brightness/contrast is sufficiently low, and be an acceptable alternative if not.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Interesting. I did just see it in IE. Before, I clicked ok, expecting something after that, and missed as the confirm was there.
    That is, according to the code, just a filter.
    So... still not sure.

    Twey's idea might work. It would work really well if you could set the blending mode, like in photoshop, to "color" or something...

    I still suggest a CSS switch and perhaps something about images... like switcing the SRCs, similar to a mouseover, or perhaps PHP GD if need be.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •