django-imagekit icon indicating copy to clipboard operation
django-imagekit copied to clipboard

How to get webp transparency?

Open fagsoft1 opened this issue 5 years ago • 11 comments

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.

fagsoft1 avatar Sep 01 '20 16:09 fagsoft1

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

Thanks.

anzaHanza avatar Sep 16 '20 12:09 anzaHanza

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

vstoykov avatar Sep 17 '20 12:09 vstoykov

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.

ckcollab avatar Apr 06 '22 02:04 ckcollab

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

fabgarsan avatar Apr 11 '22 21:04 fabgarsan

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

ckcollab avatar Apr 11 '22 21:04 ckcollab

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!

fabgarsan avatar Apr 11 '22 22:04 fabgarsan

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)

ckcollab avatar Apr 11 '22 22:04 ckcollab

@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

XFaost avatar Jul 02 '22 15:07 XFaost

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

ckcollab avatar Jul 02 '22 18:07 ckcollab

@ckcollab Done, it is working! Thank you!

XFaost avatar Jul 02 '22 19:07 XFaost

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.

hgaron-blockbar avatar Aug 08 '22 01:08 hgaron-blockbar