Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 59785
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: dorian [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.75
Fixed in: (no value)



Subject: Clarification of hardinvert behaviour
According to the documentation in Imager::Filters, the 'hardinvert' filter is supposed to invert all channels of an image including the alpha channel. When I ran my test script (./hardinvert.pl bipartite-test.png > bipartite-out.png) it appears that the alpha channel was left alone. If the alpha channel was inverted as well, would it not create a knockout where the original shape was and fill in the erstwhile negative space with (in this case black) pixels, or am I misinterpreting things? Anyhow, it seems to me that leaving the alpha channel alone is certainly more common (if not outright more desirable) behaviour, as those interested in truly messing with the alpha channel would probably want to do it on its own. I just want to make sure that the behaviour stays the same across releases. Thanks
Subject: hardinvert.pl
#!/usr/bin/perl use strict; use warnings FATAL => 'all'; use Imager; my $im = Imager->new; $im->read(file => $ARGV[0]) or die $im->errstr; $im->filter(type => 'hardinvert'); $im->write(fh => \*STDOUT, type => 'png') or die $im->errstr;
Subject: bipartite-test.png
Download bipartite-test.png
image/png 15.2k
bipartite-test.png
Subject: bipartite-out.png
bipartite-out.png
On Wed Jul 28 13:51:52 2010, DORIAN wrote: Show quoted text
> According to the documentation in Imager::Filters, the 'hardinvert' > filter is supposed to invert all channels of an image including the > alpha channel. When I ran my test script (./hardinvert.pl > bipartite-test.png > bipartite-out.png) it appears that the alpha > channel was left alone. > > If the alpha channel was inverted as well, would it not create a > knockout where the original shape was and fill in the erstwhile negative > space with (in this case black) pixels, or am I misinterpreting things? > > Anyhow, it seems to me that leaving the alpha channel alone is certainly > more common (if not outright more desirable) behaviour, as those > interested in truly messing with the alpha channel would probably want > to do it on its own. I just want to make sure that the behaviour stays > the same across releases. > > Thanks
Thanks for the report. I'll change the documentation to indicate that the alpha channel is left alone. I may add another filter that inverts all channels (though that's possible with the convert() method.) Tony
On Wed Jul 28 13:51:52 2010, DORIAN wrote: Show quoted text
> According to the documentation in Imager::Filters, the 'hardinvert' > filter is supposed to invert all channels of an image including the > alpha channel. When I ran my test script (./hardinvert.pl > bipartite-test.png > bipartite-out.png) it appears that the alpha > channel was left alone. > > If the alpha channel was inverted as well, would it not create a > knockout where the original shape was and fill in the erstwhile negative > space with (in this case black) pixels, or am I misinterpreting things? > > Anyhow, it seems to me that leaving the alpha channel alone is certainly > more common (if not outright more desirable) behaviour, as those > interested in truly messing with the alpha channel would probably want > to do it on its own. I just want to make sure that the behaviour stays > the same across releases.
This is fixed in Imager 0.77: - update the documentation of hardinvert to match the change in 0.62. https://rt.cpan.org/Ticket/Display.html?id=59785 - added hardinvertall filter which also inverts the alpha channel (sorry for the mess) which has just been released. Thank you for your report. Tony