diff --git a/images.db b/images.db index f012fc4..7cdf71b 100644 Binary files a/images.db and b/images.db differ diff --git a/loader.py b/loader.py index 1f9952b..fe0a224 100644 --- a/loader.py +++ b/loader.py @@ -92,8 +92,13 @@ def processWork(work : models.Artwork): f = loadEmotionsFromMs(work.filename) work.faces = f work.save() - if not os.path.exists(work.getThumbPath()): + if not os.path.exists(work.getThumbPath()) or work.width is None or work.height is None: img = Image.open(work.filename) + + work.width = img.size[0] + work.height = img.size[1] + work.save() + img.thumbnail((200,200)) img.save(work.getThumbPath()) return diff --git a/models.py b/models.py index a7b1ae6..9bdcd4a 100644 --- a/models.py +++ b/models.py @@ -58,6 +58,8 @@ class Artwork(BaseModel): emotion = ForeignKeyField(Emotion, related_name='artworks', index=True) created_date = DateTimeField(default=datetime.datetime.now) filename = CharField() + width = IntegerField(null=True) + height = IntegerField(null=True) colours = ColoursField(null=True) # serialised colours + percentages: [([r,g,b], percentage), ...] faces = JsonField(null=True) # Serialised MS data