The problem is that when I test it in IE 6 the image will request a new image from the server. Normally new browsers will load an image once and there are several ways to use that image again.
NEW SIMPLEIMAGE JAVASCRIPT CODE
If you execute my code by replacing those lines you probably realize that they both swap Red and green value but the pixel of a man on the image(drewgreen.png) will be different that means the first one didn't change the man color or fg but the second one has huge effect on the man color(pixels). I'm trying to clone an image in javascript, bud without loading a new one. \ if you want to confirm use DLTP environment then it gives (r:255,g:0,b:0 )Īnd also the second one have the same value (r:255,g:0,b:0 ) even though there is typeo difference. in my function case the red one gets value of green(255) before the G turn to 0. SO it will be two different colors: (0,0,255) and (0,255,0).īut your calculation somehow incorrect because in this case it gets blue value which is 0 and set as G. In you first case you have var G = pixel.getBlue() // when(r:0 ,g:255 ,b:0). Print (pix2) // for testing the before and after of the pixel swap` Var pix2 = img.getPixel(50,50) // this is for testing the before and after of the pixel swap
![new simpleimage javascript new simpleimage javascript](https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/02/1454335908es6-arrow-functions-new-fat-and-concise-syntax-in-js03-basic-syntax-with-multiple-parameters.png)
Print (pix) //this is for testing the before and after of the pixel swap Var pix = img.getPixel(50,50) //this is for testing the before and after of the pixel swap It is probably overkill, but it appears to work. I have come up with a solution, which seems to work, but it is not in the form of a function as of now. So, for an image it would be r:0 g:255 b:0 before the code is run, and r:255 g:255 b:0 after the code is run. I think your code swaps the green value into red, then checks red's value (which is now the value from green), then inserts that value into green. Print (pix2) ` //print the pixel value for pixel at 1,1 Simple Image paste image URL and get the image Block rendered.
![new simpleimage javascript new simpleimage javascript](https://miro.medium.com/max/1104/1*XhTsAjr1_GmF307w-oAlEA.gif)
NEW SIMPLEIMAGE JAVASCRIPT HOW TO
Var pix2 = img.getPixel(1,1) // added this code to check the pixel value after processing Final result of guide series learning how to create own Block Tool for Editor.js. Print (pix) //print the pixel value for pixel at 1,1
![new simpleimage javascript new simpleimage javascript](https://img.freepik.com/free-photo/small-clock-shiny-table_23-2147992858.jpg)
Var pix = img.getPixel(1,1) // added this code to check the pixel values before processing `var img = new SimpleImage("eastereggs.jpg") I used an image with a green background for my test of your code, and it converts the green background to a yellow background, whereas I think it should be a red background. I added some code to check the before and after values for a pixel and it doesn't correctly swap pixels. Your code seems to fail at swapping the pixel values for red and green. Please forgive any mistakes I have made as I am very new to coding. Write a program to draw a square 200 pixels by 200 pixels that looks like this square with colors red (red value 255), green (green value 255), blue (blue value 255) and magenta (red value 255 and blue value 255).