# NativeImage
-In Electron for the APIs that take images, you can pass either file paths or
-`NativeImage` instances. When passing `null`, an empty image will be used.
+In Electron, for the APIs that take images, you can pass either file paths or
+`NativeImage` instances. An empty image will be used when `null` is passed.
-For example, when creating a tray or setting a window's icon, you can pass an image
-file path as a `String`:
+For example, when creating a tray or setting a window's icon, you can pass an
+image file path as a `String`:
```javascript
var appIcon = new Tray('/Users/somebody/images/icon.png');
var window = new BrowserWindow({icon: '/Users/somebody/images/window.png'});
```
-Or read the image from the clipboard:
+Or read the image from the clipboard which returns a `NativeImage`:
```javascript
var clipboard = require('clipboard');
On platforms that have high-DPI support, you can append `@2x` after image's
file name's base name to mark it as a high resolution image.
-For example if `icon.png` is a normal image that has standard resolution, the
+For example if `icon.png` is a normal image that has standard resolution, then
`icon@2x.png` would be treated as a high resolution image that has double DPI
density.
* `@4x`
* `@5x`
-## Template image
+## Template Image
Template images consist of black and clear colors (and an alpha channel).
Template images are not intended to be used as standalone images and are usually
The most common case is to use template image for menu bar icon so it can adapt
to both light and dark menu bars.
-Template image is only supported on Mac.
+Template image is only supported on OS X.
-To mark an image as template image, its filename should end with the word
+To mark an image as a template image, its filename should end with the word
`Template`, examples are:
* `xxxTemplate.png`
* `xxxTemplate@2x.png`
-## nativeImage.createEmpty()
+## Methods
+
+The `NativeImage` class has the following methods:
+
+### `NativeImage.createEmpty()`
Creates an empty `NativeImage` instance.
-## nativeImage.createFromPath(path)
+### `NativeImage.createFromPath(path)`
* `path` String
Creates a new `NativeImage` instance from a file located at `path`.
-## nativeImage.createFromBuffer(buffer[, scaleFactor])
+### `NativeImage.createFromBuffer(buffer[, scaleFactor])`
* `buffer` [Buffer][buffer]
-* `scaleFactor` Double
+* `scaleFactor` Double (optional)
-Creates a new `NativeImage` instance from `buffer`. The `scaleFactor` is 1.0 by
-default.
+Creates a new `NativeImage` instance from `buffer`. The default `scaleFactor` is
+1.0.
-## nativeImage.createFromDataUrl(dataUrl)
+### `NativeImage.createFromDataUrl(dataUrl)`
* `dataUrl` String
Creates a new `NativeImage` instance from `dataUrl`.
-## Class: NativeImage
+## Instance Methods
+
+The following methods are available on instances of `nativeImage`
-This class is used to represent an image.
+```javascript
+var image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
+```
-### NativeImage.toPng()
+### `image.toPng()`
-Returns a [Buffer][buffer] that contains image's `PNG` encoded data.
+Returns a [Buffer][buffer] that contains the image's `PNG` encoded data.
-### NativeImage.toJpeg(quality)
+### `image.toJpeg(quality)`
-* `quality` Integer between 0 - 100 (required)
+* `quality` Integer between 0 - 100 (**required**)
-Returns a [Buffer][buffer] that contains image's `JPEG` encoded data.
+Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data.
-### NativeImage.toDataUrl()
+### `image.toDataUrl()`
-Returns the data URL of image.
+Returns the data URL of the image.
-### NativeImage.isEmpty()
+### `image.isEmpty()`
-Returns whether the image is empty.
+Returns a boolean whether the image is empty.
-### NativeImage.getSize()
+### `image.getSize()`
Returns the size of the image.
[buffer]: https://iojs.org/api/buffer.html#buffer_class_buffer
-### NativeImage.setTemplateImage(option)
+### `image.setTemplateImage(option)`
* `option` Boolean
Marks the image as template image.
-### NativeImage.isTemplateImage()
+### `image.isTemplateImage()`
-Returns whether the image is a template image.
+Returns a boolean whether the image is a template image.