Usage no npm install needed!

<script type="module">
  import readyimage from '';



Load and Optimize Photos in the Browser

ReadyImage is a promise-based image resizer / optimizer. ReadyImage uses and requires blueimp's loadImage library. Photo orientation is corrected automatically. Optionally the photo can be resized to a max width/height and max quality. Photos can also be optionally cropped from the center/center as a square at the maximum width and quality.

The optimized / resized image data is returned in the promise as a data URL (base64 encoded image). The data can be applied as the source of an image to be displayed in the browser, or sent over the network to be saved for use later.

Adding ReadyImage to your Project

On the Web via jsdelivr CDN

// blueimp's loadImage library
<script src="">

// readyImage
<script src="">


  • maxWidth (integer. Defaults to 1024)
  • maxHeight (integer)
  • quality (decimal percentage. Default to 1.0)
  • type (file type. Defaults to "jpeg")
  • crop (boolean. Defaults false)

Using readyImage

Example: readyImage accepts the files inputted by the user into a file input.

// Create a file input and drop in on the page
var fileInput = document.createElement('input');
fileInput.type = "file";

// Create an image element and drop it on the page
var image = document.createElement('img');

// readyImage options
var options = {
  "quality": 0.50,
  "crop": false

// When user changes or selects a file with the file input...
fileInput.onchange = () => {

  // If they selected a file...
  if (fileInput.files[0]) {

    // ready the image...

      // The image is ready. Display it in the image element.
      console.log('image ready!');
      image.src = result;

    }).catch(err => {

      // The user selected a file that is not supported as an image...

  } else {

    // The user did not select any image or file... (hit cancel perhaps...)
    console.log('No image selected.');