I am having trouble processing my image using HTML

2019-09-01 23:57发布

The Javascript "pixastic.custom (5) file was created from Pixastic using just the core code and "lighten" filter. The code works to redraw the image in the canvas in a Mozilla Broweser, however it is not filtering it. The HTML5 is coding the canvas, drawing the image on the canvas, and supposed to be redrawing the image through the Javascript Filter on to the canvas where it would then be lightened. Does any of this make sense?

Here is my code below:

<!DOCTYPE HTML>
<html>
<head>
    <script type="text/javascript" charset="utf-8" src="pixastic.custom  (5).js"></script>
    <style>
        body {
            margin: 0px;
            padding: 0px;
        }
        #myCanvas {
            border: 1px solid #9C9898;
        }
    </style>
    <script>
        window.onload = function() {
            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");
            var imageObj = new Image();
            imageObj.onload = function() {
                var options ={};
                Pixastic.process(imageObj, "lighten", options)
                    {amount : .5
                };
                options.resultCanvas;
                context.drawImage(imageObj, 80, 60);
            }

            imageObj.src = "IMAG8703.jpg";
        };
    </script>
</head>
<body>
    <canvas id="myCanvas" width="2000" height="4000"></canvas>
</body>
    </html>

Thank you for looking over my code...I really have no idea why it isn't working. Everything is in the same directory and everything matches up. The code is combined from the PIXASTIC site with HTML5 Canvas framework everything should work smoothly...

1条回答
\"骚年 ilove
2楼-- · 2019-09-02 00:21

The problem is at the 7th line from the script tag. Not sure what you are trying to do but there's gonna be an error.

This is legal.

Pixastic.process(imageObj, "lighten", {amount : .5});
查看更多
登录 后发表回答