Why does this not work?
from wand.image import Image
def upload_to_cars(instance, filename):
blocks = filename.split('.')
ext = blocks[-1]
filename = "%s.%s" % (instance.name.replace(" ", "-"), ext)
with Image (filename=filename) as img:
img.type='grayscale';
img.save
return filename
class Cars(models.Model):
name = models.CharField(max_length=200)
image_file = models.ImageField(upload_to=upload_to_cars, null=True, blank=True)
I want to upload an image and greyscale it in django. Everytime when I run this code it throws an
`decode delegate for this image format 'Porsche' @ error/constitute.c/ReadImage/544
Porsche is the name of the Class and supposed to be the name of the uploaded imagefile
Help!