大家新年快乐!
我在Mathematica 11中运行以下代码但我无法理解输出。 b和b1具有相同的大小,并且以字符显示时看起来相同,但Mathematica对它们的看法不同。你能就这为什么会这样给我一些建议吗?
a = Import["ExampleData/rose.gif"];
b = ExportString[a, "PNG"];
c = ImportString[b, "PNG"];
Export["D:/flower.txt", b];
b1 = Import["D:/flower.txt"];
ByteCount /@ {b, b1}
b == b1
最好的祝福!
要导出到文本,您需要字符串形式的b
。转换为PNG和Base64有效。
a = Import["ExampleData/rose.gif"];
b = ExportString[a, {"Base64", "PNG"}]
c = ImportString[b, {"Base64", "PNG"}]
Export["D:/flower.txt", b, "String"];
b1 = Import["D:/flower.txt", "String"];
ByteCount /@ {b, b1}
b == b1
{41016, 41016} True
新年快乐!