Private
Public Access
1
0

image size to image model

This commit is contained in:
Sander Roosendaal
2017-10-10 09:21:34 +02:00
parent 357e077194
commit b4d854c481
5 changed files with 94 additions and 3 deletions

View File

@@ -10,6 +10,8 @@ from rowers.tasks import (
from rowers.models import GraphImage
from PIL import Image
import numpy as np
import yaml
import argparse
@@ -181,10 +183,16 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
title,hrpwrdata,
plotnr,imagename)
try:
width,height = Image.open(fullpathimagename).size
except:
width = 1200
height = 600
i = GraphImage(workout=w,
creationdatetime=timezone.now(),
filename=fullpathimagename)
filename=fullpathimagename,
width=width,height=height)
i.save()
return i.id