简体   繁体   中英

Convert an image to grayscale in HTML/CSS and save the new image

Is there anyway that I can convert the image to Gray scale or such other types by adding filters in (html and css) and then Save the new image back into server.

This is what I have and I want to be able to keep the grayscale page stationary and save it as a new photo I also have svg file

<title>canvas image manipulation</title>
<style>
    img {
filter: none;
        -webkit-filter: grayscale(0);

    }

    img:hover {
        filter: url(filters.svg#grayscale); /* Firefox */
        filter: gray; /* IE */
        -webkit-filter: grayscale(1); /* Webkit */
    }
</style>
</head>
<body>

<img src="profile.jpg">
<input type="button" class="img:hover" value="button">

This link might help you: http://www.html5rocks.com/en/tutorials/canvas/imagefilters/

As far as re-saving it on the server, I don't think you'll need to do that as long as the HTML filters the image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM