首页上一页 1 下一页尾页 5 条记录 1/1页
文字水印总是提示图片格式错误
发表在Python图书答疑
2021-02-19
《PyQt5&Python游戏开发》第15章 明日图片助手(Python+PyQt5+PIL模块实现)
是否精华
是
否
版块置顶:
是
否
(imgnewImgPath): : = Image im = Image.open(img).convert() newImg = Image.new(im.size()) font = ImageFont.truetype(.fontInfo.pointSize()) imagedraw = ImageDraw.Draw(newImg) imgwidthimgheight = im.size txtwidth = .fontSize.maxWidth() * len(.lineEdit.text()) txtheight = .fontSize.height() .comboBox.currentText() == : position = () .comboBox.currentText() == : position = (imgheight - txtheight) .comboBox.currentText() == : position = (imgwidth - txtwidth) .comboBox.currentText() == : position = (imgwidth - txtwidthimgheight - txtheight) .comboBox.currentText() == : position = (imgwidth / imgheight / ) imagedraw.text(position.lineEdit.text()=font=) alpha = newImg.split()[] alpha = ImageEnhance.Brightness(alpha).enhance(int(.horizontalSlider.value()) / ) newImg.putalpha(alpha) Image.alpha_composite(imnewImg).save(newImgPath) Exception: QMessageBox.warning(QMessageBox.Ok)