我想从网上得到一张图片,然后上传到亚马逊s3。在这样做的同时,我想检查图像的尺寸。我在Python 3中有以下代码:
from PIL import Image
import requests
# Get response
response = requests.get(url, stream= True)
# Open image
im = Image.open(response.raw)
# Get size
size = im.size
# Upload image to s3
S3.Client.upload_fileobj(
im, # This is what i
我试图从以下链接中抓取以下svg:
我正在努力刮的部分如下:
我不需要图表中的文字(只是图表本身)。然而,我从来没有刮过一个svg图像,我不确定这是否可能。我环顾四周,发现没有任何有用的python包可以直接这样做。
我知道我可以使用selenium对python进行截图,然后使用PIL将其裁剪并保存为svg,但我想知道是否有更直接的方法从页面上抓取这些图表。任何有用的包或实现都是有帮助的。谢谢。
编辑:获得了一些选票,但不知道为什么我要用我的方式来实现它。
import sys
import time
from PyQt4.QtCore import *
from PyQt4.QtGui
我有一个适合其父<object>尺寸的SVG图像。通过更改图像的currentScale和currentTranslate属性来缩放图像。如何缩放要显示的图像的预期大小并使其在视口中居中?
示例代码:
<object width="500" height="300" data="pic.svg">
<!-- The image will scale to be 300px heigh,
I need it to be shown at 32x32 and centered in the v