Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
image system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2009 at 17:50 UTC
Updated:
24 Jul 2011 at 04:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Stefan Nagtegaal commentedThis is a theme dependant color imo, and should be used like that.
If you want to do this right, the only thing you could do is to re-generate the image and have a transparent background which needs:
- your image to be converted to png to allow transluscency (gif isn't reliable when rotating your image if != 90, 180, 270 °C)
Would it make sense to make a theme dependant constant like:
I'm not sure about this and we need to reach a concensus about this before I am going to start coding on this, which is pretty straight forward.
Comment #2
Stefan Nagtegaal commentedi think this should be the right status for this...
Comment #3
drewish commentedI disagree, I think it's a preset dependent setting. Some of my presets I want to have a white background, others gray and others transparent. I shouldn't have to pick one for the entire site.
Comment #4
drewish commentedAfter spending a little time working on a patch for this I'm understanding what you're saying. But I think we actually need to take a slightly different tactic and specify color and transparency separately, e.g.
becomes:
and
becomes:
This way the background color can be specified without needing to be concerned about the file format. If it supports transparency then you get transparent backgrounds and if not you get the specified color. Update: or in the case of GIF files, you can specify which color will be used for transparency if one isn't already in use.
Comment #5
dergachev commentedI spent some time trying to figure this out but imagecopyresampled was just too much of a beast.
Fortunately, the fantastic module Imagecache Actions provides a few additional actions that do what I need here.
Specifically, the "Define Canvas" action is just a negative crop with a color picker.
See http://drupal.org/project/imagecache_actions
Perhaps at least some of those actions should follow Imagecache into core?
Comment #6
drewish commentedMan this code is really tricky to get right. Here's my broken but in progress patch that at least works for rotation. Cropping still needs a ton of work.
The code is borked enough that the unit tests aren't helpful since you can't see what's wrong. So I've been using this snip it in the PHP execute block to test it:
Comment #7
hanoiiVery interested in this issue as I am experiencing the black background behavior in D5 with version 1.5, not with 1.4.
Comment #8
dman commentedAny reason why you are not using imageapi_hex2rgba() ?
This triggered me to write up my suggestion for improvements to color passing over at : #471816: API suggestion - use keyed color names, not ints in imageapi_hex2rgba()
Comment #9
drewish commentedwell imageapi_hex2rgba() isn't in core and i benchmarked it and the for loop is actually slower than just doing it in an array.
Comment #10
drewish commentedComment #11
jantoine commentedsubscribe