python - 边框出现在图像内而不是图像周围
问题描述
所以基本上,我正在尝试为图像添加边框并通过 python3 使用 img-kit 对其进行截图。我应用了边框半径和实际边框。但是,边框出现在图像内部,而不是对象周围。
这是它的外观;
我尝试了一些来自堆栈溢出的示例,例如添加填充或边距,但没有奏效。
<!DOCTYPE html>
<html>
<head>
<title>Profiles | Nekotony</title>
<style>
@font-face {
font-family: 'keepcalm';
src: url('/home/alice-bot/storage/KeepCalm-Medium.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
body {
background-color: #1C1C1C;
}
.profiles {
background: url("https://i.imgur.com/0Hl2D6w.jpg") no-repeat;
background-size: 100%;
width: 1650px;
height: 500px;
background-color: #1C1C1C;
position: fixed;
}
* {
margin: 0; padding: 0; box-sizing: border-box;
font-family: 'keepcalm', Fallback, sans-serif;
}
.img {
margin-top: 25px;
margin-left: 25px;
width: 450px;
height: 450px;
border-width: 5px;
border-color: #000000;
border-style: solid;
border-radius: 250px;
}
</style>
<meta content="text/html; charset=utf-8" http-equiv="Content-type">
<meta content="png" name="imgkit-format">
</head>
<body>
<div class="profiles">
<img class="img" src="https://i.imgur.com/X2XG1tU.png">
</div>
</body>
</html>
import imgkit
import jinja2
import string
def final_image(self, user):
html = self.render_template('final.html')
by = imgkit.from_string(str(html), False, options={"width": 1650,"height": 820,"crop-w" : 1650})
return by
def render_template(self, file_name,**context):
return jinja2.Environment(loader=jinja2.FileSystemLoader('/home/alice-bot/storage/')).get_template(file_name).render(context)
解决方案
推荐阅读
- python - 如何在python中将十进制转换为二进制值?
- css - 如何在 Angular 中切换暗模式
- visual-studio-code - 在VSCode中打开“.sql”文件时如何隐藏突出显示的行
- java - 底部导航视图
- javascript - React & D3.js:重新渲染组件会导致重新渲染相同的图形问题:
- python - 向主数据源查询 panda DataFrame 列
- python - Python 无法从图像中读取文本 [Python OCR with Tesseract]
- c - UTF-8 日语和韩文脚本在终端模拟器/tty 中的字符之间插入空格
- remote-access - 无法设置 FortiGate IPSec 远程访问 Dailup VPN
- gnuplot - 从脚本文件调用 gnuplot 时没有响应