Load/Save images with alpha channel [SOLVED]



  • On 08/04/2015 at 11:56, xxxxxxxx wrote:

    Hy there,

    I try to figure out, how I can load an image with an alpha channel, access/modify the alpha channel data and store the image back to disk.

    I need to know this for the Cinema Versions R12 and for R15.

    Thank you,

    Btw. I have tried to use the BaseBitmap and also AllocWrap it with a MultipassBitmap. I can add an alpha channel to a MP bitmap, but just an empty one. From the docs it is not clear to me, if a BaseBitmap even loads alpha information. Given that getChannelCount equals to 1 for a loaded image with alpha, it does not seem so... but then why are there methods to get/set alpha pixels? Confused...



  • On 09/04/2015 at 06:33, xxxxxxxx wrote:

    Hello,

    please notice that SDK support team can only help you with the latest release.

    To load an image with an alpha channel simply use InitWith() as usual. Then you can get an alpha channel with GetChannelNum().

    With that alpha channel you can use SetAlphaPixel() to edit this alpha channel. You can save the image with it's alpha channel using Save() with the SAVEBIT_ALPHA set.

    Best wishes,
    Sebastian



  • On 09/04/2015 at 11:33, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    please notice that SDK support team can only help you with the latest release.

    I see. But thanks for the pointers. It was enough to get it rolling...

    Here is a simple snippet for R12, for others trying to decipher the R12 API:

      
    path = "C:\ss.tif"  
      
    bit = BaseBitmap()     
    bit.InitWith(path)  
      
    alphaBit = bit.GetChannelNum(0)  
    print "AlphaPixel: ", bit.GetAlphaPixel(alphaBit, 10, 10)  
    

    Is the GetAlphaPixel call correct like this? If I just have to pass in an new empty BaseBitmap each time, why do I have to do this in the first place? 
     
    Or should it be:
    alphaBit.GetAlphaPixel(alphaBit, 10, 10)?

    Because that works too. But also here, I don't see why I would have to do that...

    Cheers,
    maxx_981



  • On 10/04/2015 at 00:27, xxxxxxxx wrote:

    Hello,

    actually, you should use GetAlphaPixel() on the original bitmap with the alpha channel as the argument. Something like this:

      
    bit.GetAlphaPixel(alphaBit,x,y)  
    

    best wishes,
    Sebastian



  • On 17/04/2015 at 09:28, xxxxxxxx wrote:

    Hello maxx_981,

    was your question answered?

    Best wishes,
    Sebastian


Log in to reply