Если в вашей задаче не требуется писать код JavaScript, то можно использовать Notepad++
- перетащите изображение в программу:
- Edit --> Select All или (Ctrl+A)
- затем: Plugins --> MIME Tools --> Base64 Encode
- в результате код image выглядит таким:
- добавьте
<img src="data:image/jpg;base64,Тут код картинки" />
к предыдущему коду.
- результат:
<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAA8ADwDASIAAhEBAxEB/8QAGwAAAgMBAQEAAAAAAAAAAAAABgcEBQgCAwn/xAA1EAACAQMEAAUBBwMDBQAAAAABAgMEBREABhIhBxMxQVEiCBQyQmGBkRUkcQkWsSMzktHw/8QAGgEAAwADAQAAAAAAAAAAAAAAAgQFAAMGAf/EACIRAAICAgICAgMAAAAAAAAAAAECAAMRIQQxEhMFUSJB4f/aAAwDAQACEQMRAD8A+lsVXDnHMHAzr2FwpwSC4BGlpFfmAHInkPca7/3AjH8R5605MMKMRlf1GAMoznJwCNSg6kA560tk3CVRSxK49DjUqm3iKfHJzg/I6OsyZ5iMAunzjXhJWQRycGkCt+ug0bx80kGQKMeq6qZdwFpT+In5Os3AjGklTsajNLHn1H86EZLvKtArgsM4GfXVTNeKiN8FX/jWbg4kaKugX8igf41IW5QKQeK5+caSN28Qbklvl8mkqIKgMoQpGshxnsnDEentqysm/wA3SlUCppTVLjzI5G4MvpksPy+vpjWsso7jAVj1HF/WYzjODjQv4oeLdg8KthXfdu4SwtVsiEkvlx+Y7FmVEVR8szKv76DW3y5h5xGGT1yVfKpg4PJugO+u8d6DPGHcAvuwaugrJIVoKl1+9GBxK4SNlkI4/B4hc+n1aBrEVSYddNljhcdzCni3/qL+JPi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