Search
 
SCRIPT & CODE EXAMPLE
 

ACTIONSCRIPT

how to resize a base64 image

function imageToDataUri(img, width, height) {

    // create an off-screen canvas
    var canvas = document.createElement('canvas'),
        ctx = canvas.getContext('2d');

    // set its dimension to target size
    canvas.width = width;
    canvas.height = height;

    // draw source image into the off-screen canvas:
    ctx.drawImage(img, 0, 0, width, height);

    // encode image to data-uri with base64 version of compressed image
    return canvas.toDataURL();
}
Comment

PREVIOUS NEXT
Code Example
Actionscript :: read pdf web on android 
Actionscript :: Application insights powershell 
Actionscript :: octahedron 
Actionscript :: silk road block-cypher 
Excel :: excel conditional formatting outside of range 
Excel :: google sheets sort column by item frequency 
Excel :: excel paste delimited text into separate columns 
Excel :: Time and date maths in Excel 
Perl :: perl slice array 
Perl :: perl sigils 
Perl :: perl mechanize infinite scroll with attempt count 
Pascal :: print in pascal 
Pascal :: pascal 
Powershell :: call function powershell 
Gdscript :: godot ignore function 
Clojure :: ex: Clojure define expected time 
Cobol :: Cobol reverse a string 
Assembly :: add text to image ffmpeg command 
Assembly :: spliting dateetimeindedx into date and time column 
Assembly :: list all sensors android 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: alphabet array 
Javascript :: javascript remover acentos 
Javascript :: javascript string to dou 
Javascript :: enable button jquery 
Javascript :: java script converting text to slug 
Javascript :: flash input 
Javascript :: jquery select checked radio button value 
Javascript :: jquery preventdefault 
Javascript :: react native position absolute center 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =