matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

How to get webp transparency? #506

Open fagsoft1 opened 3 years ago

fagsoft1 commented 3 years ago

I've been using webp for my images but when I try to used for an image with a transparent background, the image gets a white background instead.

So, is there any configuration to set transparency for webp?

Thanks.

anzaHanza commented 3 years ago

I am stuck at the sam issue as fagsoft1. How can we get transparency for webp?

Thanks.

vstoykov commented 3 years ago

I'll be happy to review a PR for that.

ckcollab commented 2 years ago

Seems fixed by using a later version of pilkit (that seems like it could use a release!)

I added this to my requirements.txt:

git+https://github.com/matthewwithanm/pilkit.git@09ffa2ad33318ae5fd3464655c14c7f01ffc2097#egg=pilkit

Woo! Glad to have fixed this on our project! django-imagekit going to save a lot of time, ty for the work on this.

fabgarsan commented 2 years ago

Seems fixed by using a later version of pilkit (that seems like it could use a release!)

I added this to my requirements.txt:

git+https://github.com/matthewwithanm/pilkit.git@09ffa2ad33318ae5fd3464655c14c7f01ffc2097#egg=pilkit

Woo! Glad to have fixed this on our project! django-imagekit going to save a lot of time, ty for the work on this.

Hi!, could you confirm with is the last version of pilkit? I'm using the 2.0 and is not still working @ckcollab

ckcollab commented 2 years ago

Yeah, like I mentioned: I think they could use a new release!

Will have to install from a SHA until a release is done @fabgarsan

fabgarsan commented 2 years ago

Yeah, like I mentioned: I think they could use a new release!

Will have to install from a SHA until a release is done @fabgarsan

Done, but it is not working. Maybe I have something wrong or missing? this is what I have:

    logo_webp = ImageSpecField(
        source='logo',
        format='WEBP',
    )

Thanks for your help!

ckcollab commented 2 years ago

Not sure man, probably a mistake on your end somewhere. I'd examine your environment and confirm proper pilkit installed (by comparing code on github, or something)

XFaost commented 2 years ago

@ckcollab I have the same problem.

image_medium = ProcessedImageField(
        upload_to='cars',
        processors=[ResizeToFit(604, 604)],
        format='PNG',
        options={'quality': 60},
        verbose_name='Photo')
image_medium_webp = ImageSpecField(
        source='image_medium',
        processors=[ResizeToFit(604, 604)],
        format='WEBP',
        options={'quality': 60})

I have no problem with png images, but webp has a white background.

Windows 10, 64x Python 3.10

requirements.txt

asgiref==3.5.2
certifi==2022.6.15
charset-normalizer==2.1.0
Django==4.0.5
django-admin-sortable2==2.1
django-appconf==1.0.5
django-filter==22.1
django-imagekit==4.1.0
djangorestframework==3.13.1
idna==3.3
Markdown==3.3.7
pilkit==2.0
Pillow==9.2.0
psycopg2==2.9.3
python-decouple==3.6
pytz==2022.1
requests==2.28.1
six==1.16.0
sqlparse==0.4.2
typing_extensions==4.3.0
tzdata==2022.1
urllib3==1.26.9
ckcollab commented 2 years ago

Try this: https://github.com/matthewwithanm/django-imagekit/issues/506#issuecomment-1089687000

XFaost commented 2 years ago

@ckcollab Done, it is working! Thank you!

hgaron-blockbar commented 2 years ago

Yeah, like I mentioned: I think they could use a new release! Will have to install from a SHA until a release is done @fabgarsan

Done, but it is not working. Maybe I have something wrong or missing? this is what I have:

    logo_webp = ImageSpecField(
        source='logo',
        format='WEBP',
    )

Thanks for your help!

Did you resolve your issue? I too am having the same issue and I have pilkit installed from SHA.

pilkit = {editable = true, ref = "09ffa2ad33318ae5fd3464655c14c7f01ffc2097", git = "https://github.com/matthewwithanm/pilkit.git"}.

Curious if any steps you took to resolve might help me resolve as well.