Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • giuse74 Friend
    #199348

    I would like disable image grayscale to color in order to see images color directly.

    How to do this?

    Thanks.

    Pankaj Sharma Moderator
    #540897

    <em>@giuse74 434816 wrote:</em><blockquote>I would like disable image grayscale to color in order to see images color directly.
    How to do this?
    </blockquote>
    Do you want to disable it for a specific section of for the whole onepage .
    Let me know i will help you solve this

    giuse74 Friend
    #540919

    I want to disable it for the whole onepage. Thanks

    Ninja Lead Moderator
    #541165

    <em>@giuse74 434883 wrote:</em><blockquote>I want to disable it for the whole onepage. Thanks</blockquote>

    Please try tweak below, it should help to disable image grayscale in JA Content Popup module.

    Open the templates/ja_onepage/js/script.js file,

    Change:


    function Grayscale(image) {
    if (supportsCanvas) {
    $(image).jaload(function () {
    var canvas = document.createElement('canvas'),
    context = canvas.getContext('2d'),
    imageData, px, length, i = 0, gray;

    canvas.width = image.naturalWidth ? image.naturalWidth : image.width;
    canvas.height = image.naturalHeight ? image.naturalHeight : image.height;

    context.drawImage(image, 0, 0);

    imageData = context.getImageData(0, 0, canvas.width, canvas.height);
    px = imageData.data;
    length = px.length;

    for (; i < length; i += 4) {
    //gray = px * .3 + px * .59 + px * .11;
    //px = px = px = gray;
    px = px = px = (px + px + px) / 3;
    }

    context.putImageData(imageData, 0, 0);
    image.src = canvas.toDataURL();

    $(image).css('opacity', 0).animate({opacity: 1}, 500);
    });
    }
    }

    To:

    function Grayscale(image) {
    var supportsCanvas = false;
    if (supportsCanvas) {
    $(image).jaload(function () {
    var canvas = document.createElement('canvas'),
    context = canvas.getContext('2d'),
    imageData, px, length, i = 0, gray;

    canvas.width = image.naturalWidth ? image.naturalWidth : image.width;
    canvas.height = image.naturalHeight ? image.naturalHeight : image.height;

    context.drawImage(image, 0, 0);

    imageData = context.getImageData(0, 0, canvas.width, canvas.height);
    px = imageData.data;
    length = px.length;

    for (; i < length; i += 4) {
    //gray = px * .3 + px * .59 + px * .11;
    //px = px = px = gray;
    px = px = px = (px + px + px) / 3;
    }

    context.putImageData(imageData, 0, 0);
    image.src = canvas.toDataURL();

    $(image).css('opacity', 0).animate({opacity: 1}, 500);
    });
    }
    }

    giuse74 Friend
    #541201

    Great! It works very well. Thank you 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

This topic contains 5 replies, has 3 voices, and was last updated by  giuse74 10 years, 4 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum