Hi Brian,
Thanks for your report.
On Tue, Jan 15, 2008 at 05:54:32AM -0500, Brian Szymanski via RT wrote:
Show quoted text> Please see the attached files - run script.pl in a directory with
> kenya-flagmap.png to generate test[12].png, the latter of which has
> exposes the bug.
>
> it seems as if qtype=>"mixing" leaves the bgcolor non-uniform, which
> isn't really a problem, because because rgb values don't matter on a
> 100% transparent pixel. however it does mean the image generated is a
> bit larger than it needs to be because a uniform bgcolor would compress
> better... this is a bug, altho by itself, it's a minor one.
Ok, the alpha channel handing introduced in 0.62 might have caused
this.
I'll take a look at improving that.
Show quoted text> in any event, when we strip the alpha channel, this has gone from
> annoyance to bug, because now that information shows thru. I'd argue
> that this is actually an API bug. it seems that stripping alpha
> information really needs an extra argument for what to do about 100%
> transparent pixels. i could see a variety of options:
> #current behavior
> $stripped = $img->convert(preset=>"noalpha", bgcolor => "inherit");
> #map to blue
> $stripped = $img->convert(preset=>"noalpha", bgcolor => "0000ff");
>
> inherit should probably be the default, but i can see cases where people
> are generating images in a web context and want to match the background
> color of their page, etc.
>
> It's arguable as to whether this is one bug or two, but something or
> another needs-a-fixin' .
This particular case isn't a bug - convert() is a purely mechanical
operation that in the case of 'noalpha' simply removes the alpha
channel. Internally, every preset converts to a simple matrix
operation performed on each pixel. I'll update the documentation to
make that clearer and to suggest the mechanism below if you want to
compose over some color.
The simplest way to compose an image over a given background color in
Imager now would be to create a background image of the given color
and then rubthrough() to it.
Perhaps I should add a method to do a one step "compose over color"
operation,
Tony