Closed harshjadon9 closed 10 months ago
@julianwachholz the module seems to not be available
@ericel the latest version on PyPI is from 2017 unfortunately. It means you'll have to install the package from source.
@vstoykov Do you have permissions to push pilkit updates?
For example:
from django.db import models from imagekit.models import ProcessedImageField from imagekit.processors import Blur
class BlurredImage(models.Model): image = ProcessedImageField(upload_to='images/', processors=[Blur(radius=5)], format='JPEG', options={'quality': 90})
2. Then apply these changes by running these commands in terminal:
> `python manage.py makemigrations`
> `python manage.py migrate`
3. Now upload your image via a form that you already have created to store the image into your database take the image from
the form and process it for blurring the image:
```python
def upload_image(request):
if request.method == 'POST':
form = ImageUploadForm(request.POST, request.FILES)
if form.is_valid():
blurred_image = BlurredImage()
blurred_image.image = form.cleaned_data['image']
blurred_image.save()
# Additional logic or redirect
else:
form = ImageUploadForm()
return render(request, 'upload_image.html', {'form': form})
This code should be provided in views.py file
New version of pilkit
is released with the GaussianBlur
processor as suggested by @julianwachholz if you update pilkit
you will be able to blur images.
### my model field :
i want to blur a image and then save it to database