फ़ॉर्म सबमिट करने से पहले इमेज को रीसाइज़ करने के लिए, आपको drawImage() मेथड का उपयोग करना होगा।
मूल इमेज को स्केल करें और स्केल्ड वर्जन को [0,0] पर कैनवास पर ड्रॉ करें
context.drawImage( img, 0,0,img.width,img.height, 0,0,myWidth,UseHeight );
ऊपर, हमने निम्नलिखित देखा:
यहां,
var myWidth = Math.floor( img.width * Scale ); var myHeight = Math.floor( img.height * Scale );
और,
var x = Math.floor( ( world.width - myWidth) / 2 ); var y = Math.floor( ( world.height - myHeight) / 2 );