Django-imagekit:如何使用 preprocessor_spec 降低图像质量?
我创建了这个简单的模型类,并使用预处理器来减少我的 照片的质量(照片的扩展名为.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
问题:图片的质量没有降低。 知道如何修复它吗?
I've created this simple model class, with a Preprocessor to reduce my
photos'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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚使用 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?
您可以尝试 https://github.com/burgalon/plupload-s3mixin 使用 plupload,允许 Flash图像大小调整,并与动态缩略图生成完美集成
You could try https://github.com/burgalon/plupload-s3mixin uses plupload, allows Flash image resizing, and integrates nicely with on-the-fly thumbnail generation