├── LICENSE.txt ├── README.md ├── favicon.ico ├── index.html ├── main.css └── script.js /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Gabriel Romualdo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Imagedit 2 | ## Cool live image editor using CSS filters. 3 | ### Check it out at: https://xtrp.github.io/Imagedit 4 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaberomualdo/imagedit/47f678bd82a56a52dd2456b2a48c22c28542e5b8/favicon.ico -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Imagedit 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 19 | 20 | 21 |

22 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /main.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | font-family: "Roboto",sans-serif; 5 | } 6 | 7 | #imgSrcForm { 8 | width: 100%; 9 | height: 100vh; 10 | text-align: center; 11 | padding: 5vh 0; 12 | } 13 | #imgSrcForm input { 14 | width: 25%; 15 | } 16 | 17 | input,button { 18 | border: none; 19 | background-color: transparent; 20 | font-size: 20px; 21 | border: 2px solid #ccc; 22 | outline: none; 23 | padding: 5px 7.5px; 24 | } 25 | button { 26 | cursor: pointer; 27 | border-left: none; 28 | } 29 | input:focus,button:hover{ 30 | border-color: black; 31 | } 32 | button:hover{ 33 | background-color: black; 34 | color: white; 35 | } 36 | 37 | #mainImage { 38 | width: 65%; 39 | height: 100vh; 40 | display: block; 41 | float: left; 42 | background-position: center; 43 | background-repeat: no-repeat; 44 | background-size: contain; 45 | } 46 | 47 | #imageEditing { 48 | width: 35%; 49 | height: 100vh; 50 | float: left; 51 | box-sizing: border-box; 52 | padding: 1.25% 5%; 53 | overflow-y: scroll; 54 | } 55 | #imageEditing div { 56 | margin-bottom: 12.5px; 57 | } -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | function openImage(src){ 2 | document.getElementById("imgSrcForm").setAttribute("style","display:none;"); 3 | document.getElementById("mainImageEditArea").removeAttribute("style"); 4 | 5 | document.getElementById("mainImageBackgroundImage").innerHTML = "#mainImage {background-image: url(" + src + ");}"; 6 | } 7 | 8 | var editValues = []; 9 | var editNames = []; 10 | var editUnits = []; 11 | 12 | window.onload = function(){ 13 | var allEditInputs = document.getElementById("imageEditing").getElementsByTagName("input"); 14 | for(var i = 0;i < allEditInputs.length;i++){ 15 | allEditInputs[i].setAttribute("id",i); 16 | editNames.push(allEditInputs[i].getAttribute("class")); 17 | editUnits.push(allEditInputs[i].getAttribute("unit")); 18 | if(allEditInputs[i].value == ""){ 19 | allEditInputs[i].value = 0; 20 | } 21 | editValues.push(allEditInputs[i].value); 22 | allEditInputs[i].oninput = function(){ 23 | if(this.value == ""){ 24 | this.value = 0; 25 | } 26 | editValues[this.getAttribute("id")] = this.value; 27 | updateFilters(); 28 | } 29 | } 30 | } 31 | function updateFilters(){ 32 | var cssCode = "#mainImage {filter: "; 33 | editValues.forEach(function(item,index){ 34 | cssCode += editNames[index] + "(" + item + editUnits[index] + ") "; 35 | }); 36 | cssCode += ";}"; 37 | document.getElementById("mainImageEdits").innerHTML = cssCode; 38 | } --------------------------------------------------------------------------------