我已成功使用以下代码从多个 PDF 页面中提取图像,但分辨率相当低。有办法调整吗?
import fitz
pdffile = "C:\\Users\\me\\Desktop\\myfile.pdf"
doc = fitz.open(pdffile)
for page_index in range(doc.pageCount):
page = doc.loadPage(page_index)
pix = page.getPixmap()
output = "image_page_" + str(page_index) + ".jpg"
pix.writePNG(output)
Run Code Online (Sandbox Code Playgroud)
我还尝试使用此处的代码并将 if pix.n < 5" 更新为 "if pix.n - pix.alpha < 4 但这在我的情况下没有输出任何图像。
我正在使用 DevOps API 将待办事项产品项目发布到我们的 DevOps。
"path": "/fields/System.Title"我知道标题 ( )、描述 ( path": "/fields/System.Description") 和评论 ( )的参考名称"path": "/fields/System.History"。
但我在文档中找不到有关标签的任何内容。我尝试"path": "/fields/System.Tags"过"/fields/Microsoft.VSTS.Common.Tags",但没有成功。
有谁知道正确的路径吗?
我正在尝试从 Confluence 页面获取 JSON 格式的表内容。这都是 SSO,所以我只能使用 API 密钥,而且我还没有找到使用请求库访问 Confluence 的方法。不幸的是,Confluence API 的输出是纯 html。
这就是我到目前为止所得到的。Confluence 库可以以 JSON 格式输出表格(而不是在字典中显示原始 html 代码)吗?
from atlassian import Confluence
import os
user = "me@myself.com"
api_key = os.environ['confluence_api_key']
server = "https://xxxxxx.atlassian.net"
api_url = "/rest/api/content"
page_id = "12345"
confluence = Confluence(url=server, username=user, password=api_key)
page = confluence.get_page_by_title("TEST", "page 1", expand="body.storage")
content = page["body"]["storage"]
print(content)
Run Code Online (Sandbox Code Playgroud)
输出如下所示:
{'value': '<p>Something something.</p><p /><table data-layout="default" ac:local-id="xxx"><colgroup><col style="width: 226.67px;" /><col style="width: 226.67px;" /><col style="width: 226.67px;" /></colgroup><tbody><tr><th><p><strong>name</strong></p></th><th><p><strong>type</strong></p></th><th><p><strong>comment</strong></p></th></tr><tr><td><p>text1</p></td><td><p>varchar(10)</p></td><td><p /></td></tr><tr><td><p>123</p></td><td><p>int</p></td><td><p /></td></tr></tbody></table>', 'representation': 'storage', 'embeddedContent': [], '_expandable': {'content': '/rest/api/content/12345'}} …Run Code Online (Sandbox Code Playgroud)