Ok, in my OWN, DESC, is what THEY, put in that DESC... Jesus, it`s just too much...
direct image link | download PNG | edit this image | share on r/pam
Description: Description: So, I have the following code snippets that I use to get the image data that I want, modify PAM's editor, and send the proper website request to make the image. You need some programming knowledge to follow through, though. **To get the image data externally (temp1 is the image element)** function base64img(i){ var canvas = document.createElement('canvas'); canvas.width = i.width; canvas.height = i.height; var context = canvas.getContext("2d"); context.drawImage(i, 0, 0); var blob = canvas.toDataURL("image/png"); return blob.replace(/^data:image\/(png|jpg);base64,/, ""); } console.log(base64img(temp1)); **To send the image (uses some code & stuff on PAM)** var _imgdata = "your image data here, as given from the earlier code!"; // Step 1 var _canvas = document.createElement("canvas"); var _ctx = _canvas.getContext("2d"); // Step 2 var _image = new Image(); _image.onload = function() { _ctx.drawImage(_image, 0, 0); }; _image.src = "data:image/png;base64," + _imgdata; // Step 3 function rgbToHex(r, g, b) { return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); } var _data = _ctx.getImageData(0, 0, _image.width, _image.height); editor.pixelArray = []; for (var x = 0; x < _data.width; x++) { editor.pixelArray[x] = []; for (var y = 0; y < _data.height; y++) { var _pixel_r = _data.data[(x + y * _data.width) * 4]; var _pixel_g = _data.data[(x + y * _data.width) * 4 + 1]; var _pixel_b = _data.data[(x + y * _data.width) * 4 + 2]; var hex = rgbToHex(_pixel_r, _pixel_g, _pixel_b); editor.pixelArray[x][y] = hex; } } // Step 4 $.ajax({ type: "POST", url: "/php/saveArt.php", data: {image:"data:text/png;base64," + _imgdata,pixel_array:LZString.compressToBase64(JSON.stringify(editor.pixelArray)),title:"Hi insanity & fox! See desc <;",description:"Here's my command. Cheers, E!",is_private:false,parent_unique_name:"",time_taken:editor.time_elapsed} });
| CREATOR ID: | 95be89 |
| VIEWS: | 60 |
| AGE: | 6 years old |
| BASED ON: |
PIXEL ART GALLERY
PIXEL ART COMMUNITY