SetImageSize is a Google Docs Addon that allows you to precisely set the size of an image. You can install it from this page. I had fun creating it and am curious if it will be used…
how to use
- select an image in your document. The image should be in bmp, gif, jpg or png format. The text flow should also be set as ‘in-line’.
- retrieve the size of the selected image with the “Get size” button.
- change the width & height to your liking. You can set the size in pixels, inches & cm.
- select “Apply” to set the new size.
- use the padlock icon to lock and unlock aspect ratio.
- the 1:1 button retrieves the original size of the image, i.e. before any changes.
- you can edit your own preferred shortcuts.
This add on will only access the current document. It will not copy any document data anywhere outside of your document.
The add on works with bitmap images (bmp, gif, jpg, png) set to ‘inline’ only (because of Google Docs API limitation). When you select an image in Docs you can indicate how the text flows around the image. The options are ‘In line’, ‘Wrap text’ and ‘Break text’.
The programming took some getting used to. The scripts that manipulate the document object model actually run on the server and you need to use a call-back mechanism from the HTML in the browser (the sidebar) to the server-side script. Once that was clear the rest was pretty easy. I probably spent more time on the UI than on the server code. The reviewer gave quick and excellent feedback to make the add-on better. Pretty nice experience. Sometimes Google makes some breaking changes to the API (e.g. the security model), then it sometimes takes a bit of time for me to realise what is going on and find the time to fix it.