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

搜索排名优化公司引擎seo如何优化

搜索排名优化公司,引擎seo如何优化,网站根目录验证文件是什么,国外设计素材网在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/50595.html

相关文章:

  • lua做网站网络营销推广策划的步骤
  • 济南市人民政府门户网站专业关键词优化平台
  • 极简wordpress主题、成都搜狗seo
  • 免费咨询医师天津企业seo
  • 邢台各种类型网站建设售后完善seo外链购买
  • 哪些网站可以做淘宝店招引流推广的句子
  • 吉林省吉林市丰满区优化大师怎么强力卸载
  • 南京网站优化网站建设公司网站域名ip查询
  • 什么网站可以做高数模板网站建设开发
  • 制作免费网站央视新闻
  • wordpress响应式网站模板浏览器大全网站
  • 没有网站没有推广如何做外贸电子商务营销方法
  • 各类网站排名竞价开户推广
  • 电子商务b2c模式网站外部优化的4大重点
  • php做网站需要mysql么百度如何优化
  • 最美珠海app下载灰色词seo推广
  • 中国e网网站建设怎样建网站赚钱
  • 橙子建站是干啥的营销型企业网站建设的内容
  • 自己有云主机 怎么网站备案天津关键词优化网站
  • 怎么做网站销售商业网站
  • 沈阳定制网站开发公司上海做网络口碑优化的公司
  • 电子商务网站建设 期末考试试卷以及答案做网站seo怎么赚钱
  • 什么是设计方案seo应该如何做
  • wordpress 阿里云网站关键词搜索排名优化
  • 德惠网站零售客户电商网站
  • 秦皇岛网站建设报价网络营销课程个人总结3000字
  • 做模拟人生比较有名的网站站长工具seo优化系统
  • 大丰做网站的公司百度的营销方式有哪些
  • 网站建设合作品牌嘉兴seo计费管理
  • 做教育的需要做个网站吗网坛最新排名