File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ const parsedImage = readSync('../example.jpg');
43
43
```
44
44
45
45
::: tip
46
- Node.js can also load an image via ` fetch ` function . To get more information take a look at "Browser" part of this section.
46
+ Node.js can also load an image via ` fetchURL ` . To get more information take a look at "Browser" part of this section.
47
47
:::
48
48
49
49
Once the image is loaded, it returns an instance of the ` Image ` class, so its methods can be applied.
@@ -72,13 +72,12 @@ writeSync('../example.jpg', image);
72
72
73
73
### Loading your first image in browser
74
74
75
- To load an image via browser, in order to instantiate it, you need to get an ` arrayBuffer ` . One of the ways :
75
+ To load an image via browser, in order to instantiate it, you may use ` fetchURL ` function :
76
76
77
77
``` ts
78
- const data = await fetch (' https:://example.com/image.jpg' );
79
- const bufferedData = await data .arrayBuffer ();
80
- let image = decode (new DataView (bufferedData )); // image is ready for usage
78
+ import { fetchURL } from ' image-js' ;
81
79
80
+ let image = await fetchURL (' https:://example.com/image.jpg' ); // image is ready for usage
82
81
image = image .grey ();
83
82
```
84
83
You can’t perform that action at this time.
0 commit comments