File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ import {
24
24
CompressedTexture ,
25
25
Vector3 ,
26
26
Quaternion ,
27
- REVISION
27
+ REVISION ,
28
+ ImageUtils
28
29
} from 'three' ;
29
30
30
31
/**
@@ -1465,7 +1466,7 @@ class GLTFWriter {
1465
1466
1466
1467
} else {
1467
1468
1468
- imageDef . uri = canvas . toDataURL ( mimeType ) ;
1469
+ imageDef . uri = ImageUtils . getDataURL ( canvas , mimeType ) ;
1469
1470
1470
1471
}
1471
1472
Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ class ImageUtils {
14
14
* Returns a data URI containing a representation of the given image.
15
15
*
16
16
* @param {(HTMLImageElement|HTMLCanvasElement) } image - The image object.
17
+ * @param {string } [type='image/png'] - Indicates the image format.
17
18
* @return {string } The data URI.
18
19
*/
19
- static getDataURL ( image ) {
20
+ static getDataURL ( image , type = 'image/png' ) {
20
21
21
22
if ( / ^ d a t a : / i. test ( image . src ) ) {
22
23
@@ -59,7 +60,7 @@ class ImageUtils {
59
60
60
61
}
61
62
62
- return canvas . toDataURL ( 'image/png' ) ;
63
+ return canvas . toDataURL ( type ) ;
63
64
64
65
}
65
66
You can’t perform that action at this time.
0 commit comments