Limitations for Inserting Images to Google Docs

Gists

When an image is inserted to Google Docs (Spreadsheet, Document and Slides) using the method of insertImage using Google Apps Script, there is the case that the error occurs. The error messages are “server error” and “invalid image data”. Here, I would like to introduce the limitations for inserting images to Google Docs. As the result, it was found that the limitation is due to both the mimeTypes and the area of image rather than the file size.

1. mimeTypes

The mimeTypes which can be inserted to Google Docs are image/jpeg, image/png and image/gif. There conditions are the same for Spreadsheet, Document and Slides.

2. Area of image

Spreadsheet

  • Image with the following sizes can be inserted.

    • 1,024 pixels x 1,024 pixels
    • 4,069 pixels x 256 pixels
    • 256 pixels x 4,096 pixels
  • Image with the following sizes can NOT be inserted.

    • 1,025 pixels x 1,025 pixels
    • 1,025 pixels x 1,024 pixels
    • 1,024 pixels x 1,025 pixels

As the result, it was found that the limitation of area is 1,048,576 pixels^2 for Spreadsheet.

Document and Slides

It was found that the limitations for Google Document and Google Slides are the same. By the experiments, the following results were obtained for Document and Slides.

  • Image with the following sizes can be inserted.

    • 5,000 pixels x 5,000 pixels
    • 25,000 pixels x 1,000 pixels
    • 1,000 pixels x 25,000 pixels
  • Image with the following sizes can NOT be inserted.

    • 5,001 pixels x 5,001 pixels
    • 5,001 pixels x 5,000 pixels
    • 5,000 pixels x 5,001 pixels

As the result, it was found that the limitation of area is 25,000,000 pixels^2 for Document and Slides.

References

 Share!