-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass Buffer as argument instead of path? How to solve following error? #18
Comments
If you have your image encoded as base64 you can do the following to get a file buffer:
Then you can use the rotate method: I hope that helps your case! |
Still the same buffer <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44
52 00 00 00 ef 00 00 00 ef 08 02 00 00 00 95 12 14 ee 00 00 00 01 73 52 47
42 00 ae ce 1c e9 00 00 00 09 ... 8612 more bytes> and same error `An error
occurred when rotating the file: Could not read EXIF data (Error: 'load'
gots invalid file data.)`
…On Tue, Oct 22, 2019 at 5:17 PM M ***@***.***> wrote:
If you have your image encoded as base64 you can do the following to get a
file buffer:
const fileBuffer =new Buffer(file.replace(/^data:.+;base64,/, ""),
'base64');
Then you can use the rotate method:
const rotateResult = await jo.rotate(fileBuffer, {quality: 100});
I hope that helps your case!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#18?email_source=notifications&email_token=AKXQNT4K7E5PCMMDQ6EMQ43QP3R37A5CNFSM4JAKTF32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB5OANQ#issuecomment-544923702>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKXQNT6GNJV6AF2SW546G3LQP3R37ANCNFSM4JAKTF3Q>
.
--
Thanks,
Mounika Kella.
|
Hello, since this error was impossible to reproduce, I will go ahead and close the issue. Please do not hesitate to reopen if you still reproduce and have a more complete example to share :) |
Basically, I have image info in base64 encoded. so, I'm converting the base64 to buffer by using the following code
const thumbnailBuffer = await Buffer.from(thumbnailBase64, "base64");
The Buffer im passing looks like this to the rotate() function.
buffer <Buffer 75 ab 5a 8a 66 a0 7b fa 67 81 b6 ac 7b ae 22 54 13 91 c3 42 86 82 80 00 00 03 52 52 11 14 80 00 00 3b c0 00 00 3b c2 00 80 00 00 25 44 85 3b 80 00 00 ... 8626 more bytes>
Below is the error when Im executing.
Please LMK if Im doing any wrong.
The text was updated successfully, but these errors were encountered: