http://www.perlmonks.org?node_id=11139988


in reply to Re^2: How to create and save an image from RGB values
in thread How to create and save an image from RGB values

Opaque is "1", transparent is "0", that's correct. When 0th (alpha in that case) channel was discarded, its content was irrelevant. Your code is not equivalent, it produces RGBA PNG image (partial random transparency over diagonal). Simply write:

raw_storechannels => 3,

then Imager will discard 4th (3d, counting from 0) i.e. alpha channel on reading, and then, too, its content would be irrelevant (ROSYBROWN's 4th byte could be any). Then file created will be opaque RGB PNG.

As an aside, I find Imager documentation excellent, but then all people are different, they say :)

Replies are listed 'Best First'.
Re^4: How to create and save an image from RGB values
by etj (Chaplain) on Dec 31, 2021 at 00:57 UTC
    This looks a lot like an application of "Einstein-inspired notation operations" (aka einops) would have helped here. I've been toying with the idea of making a translator from einops notation to PDL slice syntax, but haven't done so yet. I am 100% sure that a pull-request with a PDL::Slices::einops function (with suitable tests, even if incomplete) would be gratefully received :-D

    EDIT The future-design of PDL is being explored on this GitHub issue, including a mention of einops, and anyone with ideas would be extremely welcome to contribute!

      When consulting metacpan PDL docs yesterday, found myself continuously stumbling upon word i-am-sure-was-not-there-before. Aha, here. It's not, I believe, anywhere in "changes" or "resolved issues", is it? Please correct me if I'm wrong. Perhaps discussed privately among devs, which of course is up to them to decide, it's not critique from me, just curious to observe how things are changing in general these days. As if "piddle" was an OK for 25 years, and finally last spring fallen off "euphemism treadmill" or something.

      Update: it was announced on mailing list.

        As if "piddle" was an OK for 25 years, and finally last spring fallen off "euphemism treadmill" or something.

        Now .... if we can just get Linux users to universally refrain from using that vulgar term "root" ;-)

        Cheers,
        Rob
        A change so significant needs to be in the docs
Re^4: How to create and save an image from RGB values
by bliako (Monsignor) on Dec 28, 2021 at 15:12 UTC

    got it thanks. it's just I was not able to find in the doc how to do something IMO trivial.