Subj。爲什麼會這樣? 我試過所有的Qt toBase64的標誌,但沒有任何改變。Qt toBase64和Linux base64不同
擊:
cat Invader_1.png | base64
輸出:
iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz AAALEwAACxMBAJqcGAAAA0JJREFUeJzt3MFt20AURdHnQIWoFLoSq5S4E7uSsBR24mxiIIsgSDIT cex3DjBLjT5J4ULcTAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAACcY0vyNmFt9x27yhbPaKovZw8AnEcAoJgAQDEBgGICAMUEAIoJABQTACgm AFBMAKCYAEAxAYBiAgDFBACKCQAUEwAod jl7gIUcSZ4n7fV18PNHkpfhKdZyS3Id3GPPnGd0TNgD FMNP + IK1 + 51nvoc97styvAJAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQT ACgmAFBMAACSbBk/sML6GGsLSfwDgGoCAMUEAIoJABQTACgmAFBMAKCYAEAxAYBiAgDFBACKCQAU EwAoJgBQTACgmABAscvZA0xyS3Id3GP08 + 9ekxyDe1yTPA1PspaV7sst44eCHEleBvdgkj3nnzIz 87SZbYHrcF9 + V/YJ13M6rwBQTACgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUE AIoJABQTACj2cPL3b0m + nTwDnOkxJx4u4h8AFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQTACgm AFBMAKCYAEAxAYBiAgDFBACKXc4eYJLXJMfgHtckT8OT8BH4vSxiS/I2YW0LzWKtv7aM2xaa5Z95 BYBiAgDFBACKCQAUEwAoJgBQTACgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBmO8xyYP1 X9bjXzwH/oAAQDEBgGICAMUEAIoJABQTACgmAFBMAKCYAEAxAYBiAgDFBACKCQAUEwAoJgBQTACg 2OXk7z + SPE/aZ8YeM2bZfqwVvGT83lyT3Ab3mGXP5/u9HBP2YCF7 krdF1jbherYFruN97ROuh594 BYBiAgDFBACKCQAUEwAoJgBQTACgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAn3wG6mDu8 W58tNgAAAABJRU5ErkJggg ==
的Qt:
QImage image;
image.load("/home/undead/Pictures/1489180309_Invader_1.png");
image.save(&buffer, "PNG");
buffer.close();
bytes_array = bytes_array.toBase64();
輸出:
iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAAAsTAAALEwEAmpwYAAADQklEQVR4nO3cwW3bQBRF0edAhagUuhKrlLgTu5KwFHbibGIgiyBIMhNx7HcOMEuNPknh QtxMAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJxjS_I2YW33HbvKFs9oqi9nDwCcRwCgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQTACh2OXuAhRxJnift9XXw80eSl-Ep1nJLch3cY8-cZ3RM2AN-ac_4iTX7nWe-hz3uy3K8AkAxAYBiAgDFBACKCQAUEwAoJgBQTACgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAAJJsGT-wwvoYawtJ_AOAagIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQTACgmAFBMAKCYAECxy9kDTHJLch3cY_Tz716THIN7XJM8DU-ylpXuyy3jh4IcSV4G92CSPeefMjPztJltgetwX36_9gnXczqvAFBMAKCYAEAxAYBiAgDFBACKCQAUEwAoJgBQTACgmABAMQGAYgIAxQQAigkAFBMAKPZw8vdvSb6dPAOc6TEnHi7iHwAUEwAoJgBQTACgmABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIpdzh5gktckx-Ae1yRPw5PwEfi9LGJL8jZhbQvNYq2_tozbFprln3kFgGICAMUEAIoJABQTACgmAFBMAKCYAEAxAYBiAgDFBACKCQAUEwAoJgBQTACgmABAMQGY7zHJg_Vf1uNfPAf-gABAMQGAYgIAxQQAigkAFBMAKCYAUEwAoJgAQDEBgGICAMUEAIoJABQTACgmAFBMAKDY5eTvP5I8T9pnxh4zZtl-rBW8ZPzeXJPcBveYZc_n-70cE_ZgIXuSt0XWNuF6tgWu433tE66Hn3gFgGICAMUEAIoJABQTACgmAFBMAKCYAEAxAYBiAgDFBACKCQAUEwAoJgBQTACgmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCffAbqYO7xbny02AAAAAElFTkSuQmCC
怎麼樣'buffer'和'bytes_array'界定? –
如果我沒有弄錯PNG有壓縮級別。當你在做'image.save(&buffer,「PNG」);'QImage可以保存在不同的級別。 – JustRufus
我們可以得到一些驗證,說明輸入是一點一點的嗎? – MrEricSir