Skip to content

Commit 09b1530

Browse files
committed
Docs: Add original dimension normalization notes.
1 parent 4ecf3b9 commit 09b1530

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,17 @@ loadImage(
234234
console.log('Original image width: ', data.originalWidth)
235235
console.log('Original image height: ', data.originalHeight)
236236
},
237-
{ maxWidth: 600 }
237+
{ maxWidth: 600, meta: true }
238238
)
239239
```
240240

241+
**Please note:**
242+
The original image dimensions reflect the natural width and height of the loaded
243+
image before applying any transformation.
244+
For consistent values across browsers, [metadata](#metadata-parsing) parsing has
245+
to be enabled via `meta:true`, so `loadImage` can detect automatic image
246+
orientation and normalize the dimensions.
247+
241248
#### Error handling
242249

243250
Example code implementing error handling:
@@ -264,7 +271,7 @@ argument and the
264271
API is available, it returns a `Promise` object:
265272

266273
```js
267-
loadImage(fileOrBlobOrUrl, { maxWidth: 600 })
274+
loadImage(fileOrBlobOrUrl, { maxWidth: 600, meta: true })
268275
.then(function (data) {
269276
document.body.appendChild(data.image)
270277
console.log('Original image width: ', data.originalWidth)
@@ -284,6 +291,9 @@ The `Promise` resolves with an object with the following properties:
284291
- `originalWidth`: The original width of the image.
285292
- `originalHeight`: The original height of the image.
286293

294+
Please also read the note about original image dimensions normalization in the
295+
[callback arguments](#callback-arguments) section.
296+
287297
If [metadata](#metadata-parsing) has been parsed, additional properties might be
288298
present on the object.
289299

0 commit comments

Comments
 (0)