今天同事让帮忙将bmp图像转换到Base64格式的字符串,尝试了一下,
直接上代码吧!!(环境:vs2015 + Qt5.9)
头文件:
#pragma once #include <QtWidgets/QMainWindow> #include "ui_Bmp2Base64vs.h" class QImage; class Bmp2Base64vs : public QMainWindow { Q_OBJECT public: Bmp2Base64vs(QWidget *parent = Q_NULLPTR); bool load_img_from_file(const QString &file_name); //image 转 base64 字符串 QString bmp_2_base64_string(const QImage& img); QString bmp_2_base64_string_from_file(const QString& file_name); //base64 转 QImage QImage base64_string_2_img(const QString& str); private slots: void on_click_btn_open_img(); void on_click_btn_convert_2_Base64_string(); void</

本文介绍了如何在Qt环境下将QImage对象转换为Base64格式的字符串,提供了C++代码示例,适用于VS2015 + Qt5.9的开发环境。博主分享了实现过程,并邀请读者分享更优方法。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



