cordova 将 base6/png 转换为 .bmp 文件

问题描述

在我的 Cordova 应用程序中,我必须打印一些标签,因此从某些 API 获取 base64 图像数组。

从那里我需要将它们保存为 .bmp 图像文件到存储。

现在我使用 cordova-plugin-file 来保存 .png,但有些打印机仅支持 BMP 最大 256 色图形。这就是为什么我想从现在开始只使用 .bmp

var myBase64 = "data:image/png;base64,xxxxxxxx";
var contentType = "image/png";
var folderpath = cordova.file.externalRootDirectory;
var filename = "image.png";
savebase64AsImageFile(folderpath,filename,myBase64,contentType);

这里是完整的脚本https://ourcodeworld.com/articles/read/150/how-to-create-an-image-file-from-a-base64-string-on-the-device-with-cordova

尝试使用 contentType = "image/bmp" 但没有用,我也尝试过这个 https://gist.github.com/kgmstwo/8e3140edff841d548fbc 但没有成功。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)