本文介绍了Django-imagekit:如何使用preprocessor_spec降低图像质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了这个简单的模型类,使用预处理器来减少我的
照片质量(照片的扩展名为.JPG):
I've created this simple model class, with a Preprocessor to reduce myphotos'quality (the photos'extension is .JPG):
from django.db import models
from imagekit.models import ImageModel
from imagekit.specs import ImageSpec
from imagekit import processors
class Preprocessor(ImageSpec):
quality = 50
processors = [processors.Format]
class Picture(ImageModel):
image = models.ImageField(upload_to='pictures')
class IKOptions:
preprocessor_spec = Preprocessor
任何想法如何解决?
The problem : pictures' quality are not reduced.Any idea how to fix it?
推荐答案
我刚刚尝试使用django-imagekit的最新结账示例项目页面,它工作得很好。我将质量降低到10,差异很明显。你还有问题吗?
I just tried your example using the latest checkout from the django-imagekit project page and it worked just fine. I lowered the quality to 10 and the difference was obvious. Are you still having issues with this?
这篇关于Django-imagekit:如何使用preprocessor_spec降低图像质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!