当前位置: 首页 > news >正文

html做网站首页软文是什么东西

html做网站首页,软文是什么东西,网站引导页怎么做.,怎么做购物网站的购物车在PYTHON中用zlib模块对文本进行压缩长度,写入图片的EXIF中,并在C#中读取EXIF后用SharpZipLib进行解压缩获取压缩前文本。 PS:当压缩后的字节数组长度为单数时,无法写入EXIF的XPComment中,需要在后面增加一个以utf-8编码的空格&a…

在PYTHON中用zlib模块对文本进行压缩长度,写入图片的EXIF中,并在C#中读取EXIF后用SharpZipLib进行解压缩获取压缩前文本。

PS:当压缩后的字节数组长度为单数时,无法写入EXIF的XPComment中,需要在后面增加一个以utf-8编码的空格, 使其在原基础上在1变为双数 。另外,解压时要根据压缩时的编码选择对应的解压编码。

PYTHON代码

def save_file(args):#增加在主图片主题属性中增加CV2抠图返回的点 START_, cnt_original, _ = cv2.findContours(synthetic, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)contours_list = cnt_original[0].tolist()process_contours_list = []for list in contours_list:process_contours_list.append(list[0])# 数据格式 [[12,33],[1232,212],[1233,244].....]    # list转字符串process_contours_list_bytes = json.dumps(process_contours_list)   compress_contors = zlibCompress(process_contours_list_bytes)    exif_dict = piexif.load(image_name)if 'exif' not in image.info.keys():software = ""copyright = ""XPComment = ""else:exifData = piexif.load(image.info['exif'])exifData = exifData['0th']software = exifData[piexif.ImageIFD.Software]copyright = exifData[piexif.ImageIFD.Copyright]XPComment = exifData[piexif.ImageIFD.XPComment]zeroth_ifd = {piexif.ImageIFD.XPSubject: compress_contors,piexif.ImageIFD.XPComment: XPComment,piexif.ImageIFD.Software:software,piexif.ImageIFD.Copyright:copyright}# exif_dict['0th'] = zeroth_ifdexif_dict = {"0th": zeroth_ifd}# print(exif_dict)exif_bytes = piexif.dump(exif_dict)img.save(filename + "_s.jpg", format="JPEG", quality=quality, dpi=dpi,exif=exif_bytes)#用Zlib进行压缩        
# 参数为字符串,返回为bytes[]
# 当压缩后的字节数组长度为单数时,无法写入EXIF的XPComment中,需要在后面增加一个以utf-8编码的空格,
# 使其在原基础上在1变为双数            
def zlibCompress(data):compress_contors = zlib.compress(data.encode('utf-16'))if (len(compress_contors) % 2 != 0):add_byte = bytes(' ',encoding='utf-8')compress_contors += add_byte# tem_data = data + '.'# tem_data = tem_data.encode('utf-16')# compress_contors = zlib.compress(tem_data)return compress_contors 

C#读取并用SharpZipLib库 进行解压解压文本

using MetadataExtractor;
using System;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using ICSharpCode.SharpZipLib.Zip.Compression;//读取图片EXIF并解压内容
private void button6_Click(object sender, EventArgs e)
{try{string filename = "G://test/test/_200_s.jpg";if (File.Exists(filename)){StringBuilder sb = new StringBuilder();IReadOnlyList<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(filename);foreach (MetadataExtractor.Directory directory in directories){if (directory.HasTagName(40095)){byte[] resDes = directory.GetByteArray(40095);byte[] res0 = SharpZipLibDecompress(resDes);string result = System.Text.Encoding.Unicode.GetString(res0);//根据压缩时的编码选择对应的解压编码//string result = System.Text.Encoding.UTF8.GetString(res0);Console.WriteLine(result);}}}}catch (Exception ex){System.Windows.Forms.MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);}
}//用SharpZipLib进行解压
public static byte[] SharpZipLibDecompress(byte[] data){MemoryStream compressed = new MemoryStream(data);MemoryStream decompressed = new MemoryStream();InflaterInputStream inputStream = new InflaterInputStream(compressed);inputStream.CopyTo(decompressed);return decompressed.ToArray();}

http://www.ds6.com.cn/news/119541.html

相关文章:

  • 做网站注册的商标类别网页制作软件哪个好
  • wordpress小工具是哪个文件夹网站seo快速
  • 网站建设的价值信息流广告投放渠道
  • 哈尔滨网站建设刷百度关键词排名优化
  • 个人网站建设与企业网站今天时政新闻热点是什么
  • 微信对接网站推广软文300字范文
  • bcc宝塔安装wordpressseo行业岗位有哪些
  • 大的网站建设公司域名查询网站入口
  • 广州番禺职业技术学院门户网站成人计算机培训机构哪个最好
  • 网站的功能定位企业网络组建方案
  • 网校 039 网站建设多少钱产品质量推广营销语
  • 贵阳市 网站建设seo的重要性
  • 手机网站建设哪个包括哪些内容
  • 中国林业建设工程网站云南优化公司
  • 将网站建设外包出去的好处今天中国新闻
  • 新网站seo方法免费搜索引擎推广方法有哪些
  • 品牌建设网站例子百度seo排名培训
  • 安庆网站建设百度竞价托管运营
  • 个人网站注销原因如何对一个网站进行seo
  • 专业简历制作管理平台天津seo外包平台
  • 网页就是一个网站的首页seo比较好的公司
  • 爱搜索中级网站建设网络营销公司名字大全
  • 福州哪家网站制作设计高端还实惠百度手机管家
  • 建设运营平台网站的方法广州seo排名优化
  • 电商网站 开发周期专业制作网站的公司哪家好
  • 做网站制作的摘要怎么让自己上百度
  • 一个空间只能放一个网站吗磁力狗
  • 海山网站建设交换神器
  • 手机网站建设新闻官网优化包括什么内容
  • php网站做语言包app推广好做吗