Transparent output

Marcel Gutsche marcel.gutsche at gmail.com
Wed Feb 4 10:22:44 EST 2015



Hi all, 


I'm not sure if it is a bug, or whether I've just overlooked something 
obvious, but the internet did not offer much regarding this issue. I try to 
get slices from an image cube which consists of several images s = 1,...,n 
with the same dimensions. My new slice should have the width of the 
original images and the height of the number of images. Here is the code to 
do this: 


from skimage.io import ImageCollection, imsave

from os.path import join

import numpy as np


def main(dir):

   ic = ImageCollection( join(dir, '*.png' ) )

   row = 0  

   img = np.empty((len(ic), ic[0].shape[1], ic[0].shape[2]  ) )        

   for s in range(len(ic)):    

       img[s,...] = ic[s][row,...]

#   fname = 'new_{0:03d}.jpg'.format(v) # -> wrong colors

   fname = 'new_{0:03d}.png'.format(v)  # -> output image is transparent
       imsave(fname, img)



The problem is that the output images are all transparent. My input files 
are .png images with an alpha channel. I have also checked the values of 
the alpha channel of the output which are all set to 255, which, at least 
to my knowledge, should set the opacity to 100%. 


Regards, 

Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20150204/f6df162d/attachment.html>


More information about the scikit-image mailing list