tuteng
V2EX  ›  问与答

python 如何实现不同 pc 之间传输 jpg 格式的图片?

  •  
  •   tuteng · Oct 13, 2014 · 5633 views
    This topic created in 4414 days ago, the information mentioned may be changed or developed.
    我在树莓派上抓取的图片,想用python传到服务器上,但是用tcp实现的文件传输总是会导致图片失真,有时候大小也会改变,这是为什么呢
    python有没有能实现图片或者文件传输的模块呢,,,
    11 replies  •  2014-10-13 19:05:14 +08:00
    cevincheung
    cevincheung
    Oct 13, 2014
    1
    你又不压缩图片怎么可能会失真。
    tuteng
    tuteng
    OP
    Oct 13, 2014
    2
    我也不知道什么原因,完全看不出原样子了
    lerry
    lerry
    Oct 13, 2014 via Android
    3
    用http协议比较简单,服务器端用tornado,客户端用requests
    或者用ftp协议,服务器上配置个ftp服务器
    tuteng
    tuteng
    OP
    Oct 13, 2014
    4
    @lerry 可惜服务器端不是我写的,他只给了我通信协议的格式
    ChanneW
    ChanneW
    Oct 13, 2014
    5
    加校验,错误了得重传.
    gejigeji
    gejigeji
    Oct 13, 2014 via Android
    6
    不能ssh直接传吗 要不就simplehttpserver 然后wget或者脚本下载
    clino
    clino
    Oct 13, 2014 via Android
    7
    那就是服务端压缩过了
    liyaoxinchifan
    liyaoxinchifan
    Oct 13, 2014
    8
    把图片转换成16进制字符串,到服务端再转换回来怎么样
    tuteng
    tuteng
    OP
    Oct 13, 2014
    9
    我刚才在ubuntu上实验的没问题,昨天是在windows上跑的,诡异的问题,感谢大家
    billlee
    billlee
    Oct 13, 2014
    10
    怀疑你的 TCP 实现有问题。每次发送和接受检查返回值了吗?
    tuteng
    tuteng
    OP
    Oct 13, 2014
    11
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1825 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 16:05 · PVG 00:05 · LAX 08:05 · JFK 11:05
    ♥ Do have faith in what you're doing.