• Resolved kitkat223

    (@kitkat223)


    Hello, when using PHP 8.3 with LibGD 2.3.3 and ImageMagick 7.1.1, the transparent background turns black when building a retina for PNG images. This happens to all PNG images. I thought ImageMagick 6.9 was causing the issue, but after updating to 7.1.1, the problem persisted. The PHP imagick version is 3.7.0. I believe the issue is with the updated GD library. Could you please help?

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kitkat223

    (@kitkat223)

    Hello, this also happens when building avif as well

    Thread Starter kitkat223

    (@kitkat223)

    Hello, I think I have narrowed down the issue, it is with the GD Library. I disabled the GD extension and when clicking build avif it throws an error. I checked the PHP log and it is related to imagecreatefromstring(). It seems like the plugin uses GD to build avif. building retina is okay with GD off. Here’s the error code:

    .720853 [NOTICE] [1166048] [T0] [127.0.0.1:60616#APVH_example.com:7081] [STDERR] PHP Fatal error: Uncaught Error: Call to undefined function imagecreatefromstring() in?/var/www/vhosts/example.com/httpdocs/wp-content/plugins/wp-retina-2x-pro/classes/engine.php:324\nStack trace:\n#0?/var/www/vhosts/example.com/httpdocs/wp-content/plugins/wp-retina-2x-pro/classes/rest.php(667): Meow_WR2X_Engine->generate_webp_images()\n#1?/var/www/vhosts/example.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1230): Meow_WR2X_Rest->rest_build_webp()\n#2?/var/www/vhosts/example.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request()\n#3?/var/www/vhosts/example.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()\n#4?/var/www/vhosts/example.com/httpdocs/wp-includes/rest-api.php(420): WP_REST_Server->serve_request()\n#5?/var/www/vhosts/example.com/httpdocs/wp-includes/class-wp-hook.php(324): rest_api_loaded()\n#6?/var/www/vhosts/example.com/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#7?/var/www/vhosts/example.com/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action()\n#8?/var/www/vhosts/example.com/httpdocs/wp-includes/class-wp.php(418): do_action_ref_array()\n#9?/var/www/vhosts/example.com/httpdocs/wp-includes/class-wp.php(813): WP->parse_request()\n#10?/var/www/vhosts/example.com/httpdocs/wp-includes/functions.php(1336): WP->main()\n#11?/var/www/vhosts/example.com/httpdocs/wp-blog-header.php(16): wp()\n#12?/var/www/vhosts/example.com/httpdocs/index.php(17): require('/var/www/vhosts...')\n#13 {main}\n thrown in?/var/www/vhosts/example.com/httpdocs/wp-content/plugins/wp-retina-2x-pro/classes/engine.php?on line 324\n

    It is possible to make the plugin use ImageMagick to build avif or instruct GD to switch off alpha blending mode for PNGs?

    Thank you!

    Plugin Support Val Meow

    (@valwa)

    Hey @kitkat223! ??

    WordPress’s WP_Image_Editor_GD and WP_Image_Editor_Imagick should handle transparency correctly by default. Since we are using WordPress’s abstraction, manual handling of Alpha isn’t necessary unless there’s a bug in the version of WordPress you’re using.

    I’ve tested with the latest version of WordPress, and PNG retina images seem to be generated with alpha transparency as expected.

    The code uses wp_get_image_editor to retrieve your default image editor, so please ensure you are using the one you prefer, whether it’s GD or Imagick. Thanks!

    Thread Starter kitkat223

    (@kitkat223)

    Hello Meow! Thank you for the response! I am running WordPress 6.6.2. I tried using the ImageMagick Engine plugin to make WordPress use ImageMagick instead, but as soon as I clicked “Build AVIF,” the transparent background of the original PNG image and the AVIF image that it built turned black as well. This also happens to WEBP. I am not sure if this could be due to a PHP compatibility issue, as I am running PHP 8.3. I will try it again with PHP 8.2 and post back.

    Thanks again!

    • This reply was modified 1 month, 3 weeks ago by kitkat223.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.