Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Python中压缩-在c中解压缩_C#_Python_Image_Zlib_Compression - Fatal编程技术网

C# 在Python中压缩-在c中解压缩

C# 在Python中压缩-在c中解压缩,c#,python,image,zlib,compression,C#,Python,Image,Zlib,Compression,我有一个项目,其中使用Python将图像保存到sqlite3数据库 我在代码中发现: im=buffer(zlib.compress(im.tostring())) 从一个C项目中,我希望能够看到这个图像 我尝试了很多事情,但我仍然远远没有做对 相应的Python代码是: 尝试: self.cur.execute从skitse中选择img、mode、width、height,其中navn=?,label, 除: im,w,h=自返回noskite 其他: data=self.cur.fetch

我有一个项目,其中使用Python将图像保存到sqlite3数据库

我在代码中发现:

im=buffer(zlib.compress(im.tostring()))
从一个C项目中,我希望能够看到这个图像

我尝试了很多事情,但我仍然远远没有做对

相应的Python代码是:

尝试: self.cur.execute从skitse中选择img、mode、width、height,其中navn=?,label, 除: im,w,h=自返回noskite 其他: data=self.cur.fetchone 如果数据不是无且lendata>0: im=zlib.decompressstrdata[0] 模式=数据[1] w=数据[2] h=数据[3] im=图像。从StringMode,w,h,im 如果模式=RGB: im=im.RGB im=im.tostring 在C语言中,我尝试了以下方法:

公共静态图像字符串数据 { 如果数据==null { 返回null; } byte[]imageBytes=Convert.FromBase64Stringdata; MemoryStream ms=新的MemoryStream imageBytes,0,imageBytes.Length; ms.WriteimageBytes,0,imageBytes.Length; System.Drawing.Image Image=System.Drawing.Image.FromStreamms,>false,false; 返回图像; }
那对我来说什么都没有。有人能告诉我正确的方向吗?

谣传,可以在NuGet软件包中找到的DotNetZip支持zlib压缩/解压缩。这与图像没有任何关系。基本上,您需要知道pythonzlib使用什么压缩,并找到它的c替代方案。谷歌应该不会太难。好的,我可以看到。我仍然没有得到我期望的结果。我得到了两次显示的图像。谣传,可以在NuGet软件包中找到的DotNetZip具有zlib压缩/解压缩支持。这与图像没有任何关系。基本上,您需要知道pythonzlib使用什么压缩,并找到它的c替代方案。谷歌应该不会太难。好的,我可以看到。我仍然没有得到我期望的结果。我把图像显示了两次。