{"id":1961,"date":"2023-02-15T15:10:25","date_gmt":"2023-02-15T15:10:25","guid":{"rendered":"https:\/\/www.tools.keywordfinder.us\/?page_id=725"},"modified":"2023-02-15T15:10:25","modified_gmt":"2023-02-15T15:10:25","slug":"image-enlarger-2","status":"publish","type":"page","link":"https:\/\/tools.billionsideas.com\/pt\/image-enlarger-2\/","title":{"rendered":"Image Enlarger"},"content":{"rendered":"<div style=\"height:70px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column has-vivid-green-cyan-background-color has-background is-layout-flow wp-block-column-is-layout-flow\">\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Image Size Enlarger Tool<\/title>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/fabric.js\/3.6.3\/fabric.min.js\"><\/script>\n<\/head>\n<body>\n    <h1>Image Size Enlarger Tool<\/h1>\n    <input type=\"file\" id=\"imageLoader\">\n    <br><br>\n    <canvas id=\"canvas\" width=\"400\" height=\"400\"><\/canvas>\n    <br>\n    <button onclick=\"enlargeByPx()\">Enlarge by PX<\/button>\n    <button onclick=\"enlargeByRatio()\">Enlarge by Ratio<\/button>\n    <br><br>\n    Custom Width: <input type=\"number\" id=\"customWidth\">\n    Custom Height: <input type=\"number\" id=\"customHeight\">\n    <button onclick=\"enlargeByCustomSize()\">Enlarge by Custom Size<\/button>\n    <br><br>\n    <button onclick=\"enlargeOnClick()\">Click to Enlarge<\/button>\n    <br><br>\n    Enlarged Image Size: <span id=\"enlargedSize\"><\/span>\n    <br><br>\n    <button onclick=\"downloadImage()\">Download Image<\/button>\n<\/body>\n<script src=\"script.js\"><\/script>\n<\/html>\n<script>\n\/\/ Global variables\nvar canvas = new fabric.Canvas('canvas');\nvar imgWidth, imgHeight;\n\n\/\/ Function to load the image and show it in the canvas\ndocument.getElementById('imageLoader').addEventListener('change', function(e) {\n    var file = e.target.files[0];\n    var reader = new FileReader();\n    reader.onload = function(f) {\n        var data = f.target.result;\n        fabric.Image.fromURL(data, function(img) {\n            canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas), {\n                scaleX: canvas.width \/ img.width,\n                scaleY: canvas.height \/ img.height\n            });\n            imgWidth = img.width;\n            imgHeight = img.height;\n        });\n    };\n    reader.readAsDataURL(file);\n});\n\n\/\/ Function to enlarge the image by a specified number of pixels\nfunction enlargeByPx() {\n    var px = prompt(\"Enter the number of pixels to enlarge by:\");\n    var newWidth = imgWidth + parseInt(px);\n    var newHeight = imgHeight + parseInt(px);\n    canvas.setDimensions({ width: newWidth, height: newHeight });\n}\n\n\/\/ Function to enlarge the image by a specified ratio\nfunction enlargeByRatio() {\n    var ratio = prompt(\"Enter the enlargement ratio:\");\n    var newWidth = imgWidth * parseFloat(ratio);\n    var newHeight = imgHeight * parseFloat(ratio);\n    canvas.setDimensions({ width: newWidth, height: newHeight });\n}\n\n\/\/ Function to enlarge the image by a custom size\nfunction enlargeByCustomSize() {\n    var customWidth = document.getElementById(\"customWidth\").value;\n    var customHeight = document.getElementById(\"customHeight\").value;\n    var newWidth = parseInt(customWidth);\n    var newHeight = parseInt(customHeight);\n    canvas.setDimensions({ width: newWidth, height: newHeight });\n}\n\n\/\/ Function to enlarge the image on click\nfunction enlargeOnClick() {\n    canvas.on('mouse:down', function(options) {\n        var ratio = prompt(\"Enter the enlargement ratio:\");\n        var newWidth = imgWidth * parseFloat(ratio);\n        var newHeight = imgHeight * parseFloat(ratio);\n        canvas.setDimensions({ width: newWidth, height: newHeight });\n        canvas.off('mouse:down');\n    });\n}\n\n\/\/ Function to show the enlarged image size\nfunction showEnlargedImageSize() {\nvar width = canvas.width;\nvar height = canvas.height;\ndocument.getElementById(\"enlargedSize\").innerHTML = width + \" x \" + height;\n}\n\n\/\/ Function to download the image\nfunction downloadImage() {\nvar link = document.createElement('a');\nlink.href = canvas.toDataURL({\nformat: 'png',\nquality: 1.0\n});\nlink.download = 'enlarged-image.png';\ndocument.body.appendChild(link);\nlink.click();\ndocument.body.removeChild(link);\n}\n\n\n\n\n\n\n\n\n<\/script>\n\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Image Size Enlarger Tool Image Size Enlarger Tool Enlarge by PX Enlarge by Ratio Custom Width: Custom Height: Enlarge by Custom Size Click to Enlarge Enlarged Image Size: Download Image<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","footnotes":""},"class_list":["post-1961","page","type-page","status-publish"],"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"Billions Ideas","author_link":"https:\/\/tools.billionsideas.com\/pt\/author\/loginbillionsideas-com\/"},"comment_info":0,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/pages\/1961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/comments?post=1961"}],"version-history":[{"count":0,"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/pages\/1961\/revisions"}],"wp:attachment":[{"href":"https:\/\/tools.billionsideas.com\/pt\/wp-json\/wp\/v2\/media?parent=1961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}