File tree 2 files changed +21
-0
lines changed
docs/src/content/docs/guides
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,9 @@ export function createJimp<
155
155
/** Formats that can be used with Jimp */
156
156
formats : Format < any > [ ] = [ ] ;
157
157
158
+ /** The original MIME type of the image */
159
+ mime ?: string ;
160
+
158
161
constructor ( options : JimpConstructorOptions = emptyBitmap ) {
159
162
// Add the formats
160
163
this . formats = formats ;
@@ -327,6 +330,8 @@ export function createJimp<
327
330
await format . decode ( actualBuffer )
328
331
) as InstanceType < typeof CustomJimp > & ExtraMethodMap ;
329
332
333
+ image . mime = mime . mime ;
334
+
330
335
attemptExifRotate ( image , actualBuffer ) ;
331
336
332
337
return image ;
@@ -362,6 +367,16 @@ export function createJimp<
362
367
return "[object Jimp]" ;
363
368
}
364
369
370
+ /** Get the width of the image */
371
+ get width ( ) {
372
+ return this . bitmap . width ;
373
+ }
374
+
375
+ /** Get the height of the image */
376
+ get height ( ) {
377
+ return this . bitmap . height ;
378
+ }
379
+
365
380
/**
366
381
* Converts the Jimp instance to an image buffer
367
382
* @param mime The mime type to export to
Original file line number Diff line number Diff line change @@ -140,3 +140,9 @@ const resized = await image
140
140
141
141
- ` Jimp.AUTO ` - This constant was only needed for positional arguments. It is no longer needed with the new API.
142
142
- ` Jimp.MIME_* ` - These are now part of the TS api when encoding
143
+
144
+ ## Moved Functions
145
+
146
+ - ` Jimp.intToRGBA ` was moved ` import { intToRGBA } from "jimp"; `
147
+ - ` image.getHeight() ` was moved ` image.height `
148
+ - ` image.getWidth() ` was moved ` image.width `
You can’t perform that action at this time.
0 commit comments