[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #32986] imread() reads .png with alpha channel

From: Tobias Wolf
Subject: [Octave-bug-tracker] [bug #32986] imread() reads .png with alpha channel as an unexpected array format
Date: Mon, 22 Aug 2011 15:13:44 +0000
User-agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.860.0 Chrome/15.0.860.0 Safari/535.2

Follow-up Comment #7, bug #32986 (project octave):

This is a whole *bug complex* concerning image alpha, to be frank.

First, imread does not match the Matlab API concerning imread output Array
format and [I, M, A] output variables (as already mentioned below)

Second, imwrite does not follow the Matlab API in *only saving* the Alpha
channel when an image array has [:,:,4] layers if the 'Alpha' parameter has
been given separately like so 

    imwrite(img(:,:,1:3), 'img-alphsep.png', 'Alpha', img(:,:,4))

If I give Octave a [:,:,4] image it saves alpha always.

Third and most importantly, Octave misinterprets the alpha channel polarity
and inverts the alpha channel upon saving and loading. White in the alpha
channel should be taken as fully opaque and black refers to fullz transparent.
Octave mixes this up and actually reverses this channel on both imread and

I've attached a Screenshot illustrating this. Left is Octave, right is

Should I open separate bugs about parts 2 and 3, or is this one bug enough?

(file #23846)

Additional Item Attachment:

File name: inverted alpha.png             Size:1589 KB


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]