0

I asked this some days ago already over here at wordpress.stackexchange.com but didn't get any response since – so I thought it would be legit to ask over here again:

I am looking for a way to have one of the additional images sizes saved as PNG. Ideally the PNG-Version would be rendered on upload and defined through add_image_size.

So far I have only found one WP-plugin that has the built in capability of converting JPGs to PNGs (EWWW Image Optimizer) but it does not really provide the functionality I'm looking for.

I know this should be possible through the PHP function imagecreatefromjpeg – but currently I just don't know where / how to hook that into add_image_size or wherever taht should be hooked in.

I hope somebody has done this before? Any pointers / suggestion appreciated. Thank you!

tillinberlin
  • 429
  • 4
  • 14
  • 1
    `add_image_size` just changes the configuration regarding your image sizes, that’s not the correct point to hook into here. You should look into hooks like `wp_handle_upload` or `wp_generate_attachment_metadata`. – CBroe Oct 30 '20 at 09:46
  • 1
    Look at this topic for starter - https://wordpress.stackexchange.com/questions/307733/convert-all-images-to-png-on-file-upload – Angel Deykov Oct 30 '20 at 10:10

0 Answers0