Skip to content

Commit 5b23d7d

Browse files
committed
Fixed type, fixed syntax on htmlImg const, changed prefix in base64text const to be consistent
1 parent fd72345 commit 5b23d7d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,15 @@ cv.imshow('a window name', mat);
253253
cv.waitKey();
254254

255255
// load base64 encoded image
256-
const base64text='data:image/gif;base64,R0lGO..';//Base64 encoded string
256+
const base64text='data:image/png;base64,R0lGO..';//Base64 encoded string
257257
const base64data =base64text.replace('data:image/jpeg;base64','')
258258
.replace('data:image/png;base64','');//Strip image type prefix
259259
const buffer = Buffer.from(base64data,'base64');
260260
const image = cv.imdecode(buffer); //Image is now represented as Mat
261261

262-
// convert Mat to base4 encoded jpg image
262+
// convert Mat to base64 encoded jpg image
263263
const outBase64 = cv.imencode('.jpg', croppedImage).toString('base64'); // Perform base64 encoding
264-
const htmlImg='<img src='data:image/jpeg;base64,"+outBase64 + "'>'; //Create insert into HTML compatible <img> tag
264+
const htmlImg='<img src=data:image/jpeg;base64,'+outBase64 + '>'; //Create insert into HTML compatible <img> tag
265265

266266
// open capture from webcam
267267
const devicePort = 0;

0 commit comments

Comments
 (0)