PNG图像保存时损坏

huangapple go评论107阅读模式
英文:

PNG image corrupted when saved

问题

我有一段Python代码,用于迭代Excel对象并可以找到每个图表,并将其保存为png。但是,当我运行脚本并保存图像后,当我尝试查看它们时,它们是损坏的。

PNG图像保存时损坏

我尝试将它们保存为png或jpeg。我还需要使用这种方法,不能使用原始数据创建图表。

英文:

I have code that iterates through Excel objects in Python and can find each graph and saves it as a png. however, when I run the script and the images get saved, when I try and Then I view they are corrupted.

PNG图像保存时损坏

I try and save them as either a png or a jpeg. I also need to use this method cannot use the raw data to create graphs.

答案1

得分: -1

尝试在导出代码之前添加以下代码行:

chartObject.Copy
英文:

You are only saving a chart object with the name of a png file.

try adding the line:

chartObject.Copy

before the line where you do the export.

huangapple
  • 本文由 发表于 2023年7月10日 21:22:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76654188.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定