asbjornenge / asbjornenge/imgurify
Base64 returning incorrect data.
- Dominant language
- JavaScript
- Stars
- 25
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
I'm still investigating further, but just wanted to share that when when using a PNG file as input, the output base64 data has been unusable for me. When compared with the output of something like this service, they are quite different and only the service ends up being usable.
https://www.base64-image.de/
The file I used for comparison is:
http://www.fnordware.com/superpng/pnggrad8rgb.png
I've found that I've actually had success by simply reading the file as binary data and converting that to base64 as described here:
http://www.hacksparrow.com/base64-encoding-decoding-in-node-js.html
Specifically:
```
// function to encode file data to base64 encoded string
function base64_encode(file) {
// read binary data
var bitmap = fs.readFileSync(file);
// convert binary data to base64 encoded string
return new Buffer(bitmap).toString('base64');
}
```
Just wanted to share in case this was a common issue beyond my environment.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue through imgurify's Browserify image-transform entry point with pnggrad8rgb.png, then compare its Base64 output with the reference service and the binary-read example in the report. Done means the generated Base64 data for the PNG is usable and represents the same image data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100