• Resolved gunas1867

    (@gunas1867)


    Hello,

    We’re noticing on our homepage and header (credit card logos in the headers, category buttons on homepage) PNGs are not showing as transparent. This only happens in Chrome. It shows fine in Edge and Firefox. We’ve made sure Chrome was up to date, refreshed and flushed DNS, tried computers with different IPs, this issue is only isolated to Chrome.
    We’ve narrowed it down to where this issue occurs if we have a check in the box for “Load WebP or AVIF in supported browsers?” If we leave that box unchecked, PNGs become transparent again in Chrome.

    Plugin version is 2.8.1.

    Any idea on why this is? We already have the Shortpixel plugin installed on the site. Is there any negative impact on the site if we leave that box unchecked?

    For the time being, we left the box checked so if you go to https://gpwattjroperationsllc.com/ (in Chrome), you’ll see the issue we’re referring to.
    I also have links below of how the site appears if the box is checked or unchecked.

    Screenshot of box checked

    Screenshot of box unchecked

    Any help on this situation would be greatly appreciated.

    Thank you,
    Deirdre

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    likely an issue with transperancy of AVIF images in Chrome, try simply adding .png to the comma-separated image optimization exclusion list maybe?

    Thread Starter gunas1867

    (@gunas1867)

    Thanks, I added .png to “Optimization exclusions” and pngs are now showing transparent in Chrome again even if I have “Load WebP or AVIF in supported browsers?” checked. I also checked this on a separate computer and it’s showing fine as well.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK great! You can now try to make the exclusions more specific to only the files (credit card logos in the headers, category buttons on homepage) from being optimized.

    Alternatively I could provide you with a code snippet to not serve AVIF images if you want?

    Thread Starter gunas1867

    (@gunas1867)

    Hello,
    Thanks for all your help.

    Just making sure I understand this correctly. So say if I have a png image named sample.png that’s having this issue but other png images are just fine, so to fix the issue with that just that specific image, I would enter in sample.png in the “optimization exclusions” field. If I just leave it as .png, it’s going to exclude ALL the png files on the site, correct?

    Sure, you can send me that code snippet if you want. I can try it out. Where exactly would put this code snippet on the site? (In the appearance > customize > additional CSS or like in the wp-config.php?)

    Thank you!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    to fix the issue with that just that specific image, I would enter in sample.png in the “optimization exclusions” field. If I just leave it as .png, it’s going to exclude ALL the png files on the site, correct?

    100% correct ??

    Sure, you can send me that code snippet if you want. I can try it out.

    that would be:
    add_filter( 'autoptimize_filter_imgopt_do_avif', '__return_false');

    Where exactly would put this code snippet on the site? (In the appearance > customize > additional CSS or like in the wp-config.php?)

    The easiest & safest solution is using the code snippets plugin.

    Thread Starter gunas1867

    (@gunas1867)

    Hello,
    Awesome, thanks for confirming that and thanks for the snippet. I’ll try it out using that plugin. If I run into any issues, I’ll let you know.
    Thanks a ton!

    Question is, why is this issue appearing now and what is causing it?

    I’ve been using Shortpixel CDN to serve “optimized” images for some time now and never had a problem. After starting work on a new site yesterday, I noticed the same as Deirdre (on several WP sites now), where using Shortpixel CDN via AO with the “Automatically serve “next-gen” WebP or AVIF image formats” option enabled is producing images with a black background instead of transparent (when original image is a transparent PNG). This issue only occurs in Chrome.

    After some time practicing a bit of Google-fu to turn up some info, I’m still at a loss.

    Thanks,

    Brian

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    The reason is AO now also asks Shortpixel to convert the images to AVIF if the browser support the format (so currently only Chrome, soon also Firefox), and in the AVIF conversion logic the transparency seems to get lost.

    Hence the workaround to either exclude those images from being optimized (you could also exclude them from being lazyloaded, as AO depends on its own lazyload to determine of webp or avif are supported) OR to use the code snippet to tell AO not to “do” AVIF.

    hope this clarifies,
    frank

    But this isn’t exactly a new option, is it (serve AVIF)? Unless a recent update to the plugin has promoted the AVIF format?

    With dozens of sites in production using the AO plugin, I’d like to figure out where, exactly, this issue is stemming from so I can hopefully resolve/prevent it before I’m responding to client complaints.

    As I mentioned, I have some sites showing black backgrounds on transparent PNGs, whereas others are not exhibiting this issue (confirmed that Shortpixel CDN is serving AVIF image formats in both cases). All AO settings between the sites are similar, at least on the “Images” optimization tab. I’ve even flushed affected images from the Shortpixel CDN.

    Is this issue something we should be reporting to Shortpixel?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I am taking this up with Shortpixel (but you can too).
    AVIF support was introduced in AO 2.7.8, but the issue will only occur if:
    1. you have image optimization active AND
    2. you have lazyload and webp/avif active AND
    3. you have png’s with transparancy set

    frank

    kozak85

    (@kozak85)

    Hey! I have the same problem! The client wrote that the pictures do not work! I went in and all the pictures in png format became non-transparent ?? or even a black square! What has changed ??? please fix it! Or update the plugin without AVIF format, if it does not work already, then let it be only WebP

    kozak85

    (@kozak85)

    I’m sure many will soon have the same problems, especially when the cache is dropped (reset)! Just now, my colleague also wrote to me about this problem!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    either add .png to the lazyload exclusion field or use this code snippet @kozak85

    add_filter( 'autoptimize_filter_imgopt_do_avif', '__return_false');

    frank

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I conferred with Shortpixel and this is due to a recent technical change in their AVIF toolchain. They are looking at alternative solutions, but for now I would indeed suggest to either:

    * add .png to the lazyload exclusion field
    * or to use below code snippet to disable AVIF images;

    add_filter( 'autoptimize_filter_imgopt_do_avif', '__return_false');

    kozak85

    (@kozak85)

    add_filter (‘autoptimize_filter_imgopt_do_avif’, ‘__return_false’);
    If I install this, it will show everything in WebP format with lazy loading and without problems, I understand correctly? You let us know when the shortpixel fixes the error with avif ?!

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘PNG images are not transparent’ is closed to new replies.