Open iho opened 7 years ago
In [3]: from PIL import features
...: print (features.check_module('webp'))
True
Hello @iho, can you provide some example code and a traceback or error that you see?
@vstoykov I am trying to upload this file
class Image(models.Model):
file = models.ImageField(upload_to='images')
preview = ImageSpecField(source='file',
processors=[ResizeToFit(150, 150)],
format='WEBP',
options={'quality': 80})
def __str__(self):
return '/' + self.file.url
class Meta:
verbose_name = 'Зображення'
verbose_name_plural = 'Зображення'
Then I upload few images in webp, png, jpeg formats via admin panel and run this code:
for i in Image.objects.all(): print(i.preview.path)
When I try to open this files in gimp or ristretto I see these errors: I though Ristretto cannot to open webp format, but I can open this file from Google samples http://www.gstatic.com/webp/gallery/4.webp
Archive with files from CACHE: squash.zip
Please notice I cannot upload previews to imgur or on github directly. Sites give errors that they do not support this file format.
It would be great if this option is available. When would it be implemented?
@adrianvanlan I could be pillow error
It works for me. @iho did you actually create the images by calling ./manage.py generateimages
?
I am coming from normal django ImageFields
and with this setup, existing .png
images don't seem to be converted with ./manage.py generateimages
?
headshot_large = ProcessedImageField(
upload_to='public/headshots',
storage=PublicStorage(),
blank=True,
null=True,
processors=[ResizeToFill(247, 422)],
format='WEBP',
options={'quality': 80}
)
All images still seem to be .pngs
-- maybe I'm doing something stupid, apologies if so! Thanks for any help.
EDIT: looks like this problem isn't specific to WebP, moving to its own issue #549
Hi Does not work with
format='WEBP'
How to fix it?