本文整理汇总了Python中pgmagick.Image.interlaceType方法的典型用法代码示例。如果您正苦于以下问题:Python Image.interlaceType方法的具体用法?Python Image.interlaceType怎么用?Python Image.interlaceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pgmagick.Image
的用法示例。
在下文中一共展示了Image.interlaceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: specificRecord
# 需要导入模块: from pgmagick import Image [as 别名]
# 或者: from pgmagick.Image import interlaceType [as 别名]
def specificRecord(theId):
# Get the record.
aRow = db.session.query(ServiceRecord, Vehicle).filter_by(id=theId).join(Vehicle).first()
aRecord = {
"id": aRow[0].id,
"year": aRow[1].year,
"make": aRow[1].make,
"model": aRow[1].model,
"date": aRow[0].date,
"miles": aRow[0].miles,
"description": aRow[0].description
}
# Get the filepaths for the photos.
import os
aPostfix = "vehicles/receipts/{}".format(theId)
aList = [url_for("static", filename=aPostfix + os.sep + x) for x in os.listdir("app/static/" + aPostfix)]
# Create the form.
aForm = PhotoForm()
# Check to see if the form is valid as well as a post request.
if aForm.validate_on_submit():
filename = secure_filename(aForm.upload.data.filename)
aSavePath = 'app/static/vehicles/receipts/{}/'.format(theId) + filename
aForm.upload.data.save(aSavePath)
# Convert the photo to nice web stuff.
from pgmagick import Image, InterlaceType
aImg = Image(aSavePath)
aImg.quality(80)
aImg.scale("80%")
aImg.interlaceType(InterlaceType.PlaneInterlace)
aImg.write(aSavePath)
flash("File uploaded", "success")
aForm = PhotoForm()
return render_template(
"vehicles/record.html",
theRecord=aRecord,
theFiles=aList,
theForm=aForm
)