Reduce image format specific code in GD toolkit

Created on 2 October 2014, almost 11 years ago
Updated 9 April 2025, 3 months ago

Follow-up to πŸ“Œ Allow image effects to change the MIME type + extension, add a "convert" image effect Fixed

Problem/Motivation

Adding the convert operation showed us that GD resources created form different image formats, might give different reuslts when converted to yet another image format. Especially handling transparency when going from git to png or vice versa is problematic.

Furthermore it was already noticed a few times that image format should not be a property of the resource, but looking at how we open images or concert them (the createTmp() function (create_new operation once #2063373: Cannot save image created from scratch β†’ gets in) we see to much image format specific logic.

Especially, with #2340699: Let GDToolkit support WEBP image format β†’ on the horizon, reducing image format specific code is important to keep the toolkit maintainable.

Proposed resolution

This issue should investigate if we can and should always work with a fully transparent true color canvas and that only upon saving is determined how to handle transparency:
- jpg: ignore.
- png: save as is.
- gif: if there is transparency, define a new color in the palette as transparent and set all pixels that have a transparency above a given treshold, to that color index, then save to gif format.

User interface changes

None.

API changes

None. If any changes are needed, they will probably go into #2168511: Allow to pass save options to ImageInterface::save β†’ .

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

image system

Created by

πŸ‡«πŸ‡·France fietserwin Le Mont-Dore

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • Status changed to Closed: outdated about 18 hours ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there's been no follow up in 3+ months going to close this one out. If still valid task please re-open.

    Thanks

Production build 0.71.5 2024