Skip to content
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

默认返回gif格式的base64,有没有参数指定或修改返回的格式? #8

Open
dong-lufei opened this issue May 30, 2022 · 2 comments

Comments

@dong-lufei
Copy link

data:image/gif;base64,base64编码的gif图片数据
data:image/png;base64,base64编码的png图片数据

@edu-sonya-cc
Copy link

edu-sonya-cc commented Dec 12, 2022

The developer is not Chinese, so I suggest you use English to ask questions. By the way, I am also a Chinese, and my English is very poor. I usually use Baidu Translation to solve this problem.
This library was last updated on December 5, 2020, so I suggest you solve this problem with other libraries.

Maybe imagescript or imagemagick can help you. Please refer to:
https://deno.land/x/imagescript @v1.2.14/mod.ts
https://deno.land/x/imagemagick_deno @0.0.14/mod.ts

This is a sample, I use other libraries to solute another problem:
#9

===========================================================================
开发者并非中国人,因此建议您使用英文进行提问。顺便说说,我也是一名中国人,而且我的英语挺差的,通常我使用百度翻译来解決这个问题。
这个库上次更新于2020年12月5日,所以建议您结合其它库来解决这个问题。

也许deno库imagescript或imagemagick能帮助到您,请参考:
https://deno.land/x/[email protected]/mod.ts
https://deno.land/x/[email protected]/mod.ts

以下是我结合其它库来解决另一个问题的例子:
#9

@JJ
Copy link
Collaborator

JJ commented Oct 7, 2023

OK, I'll answer in English, if you don't mind. For the time being, no, that's the format returned, with the intention that it's included directly in an HTML img tag. As @edu-sonya-cc says (thanks!), converting it to an actual image can be achieved by using another library, or using these lines:

const data = base64string.slice(22);
const bytes = Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
await Deno.writeFile("tests/test.gif", bytes);

We might include that as an upgrade to this library, it wouldn't be too hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants