[Image-SIG] open, show, png, blank

Nelson Tong tongsnelson.ise at gmail.com
Wed Feb 8 19:26:40 CET 2012


thanks for the replies, everyone

I think I am going to try do what i need to do using jpg instead of png for now.

The funny thing is  this piece of code I am now trying to run used to
work  with those kind of gel png in the past when I have this
installed in an old server:

python-imaging-devel-1.1.6-3.fc7



On 2/5/12, Matthias Bock <matthiasbock at users.sourceforge.net> wrote:
> It really is a PNG and it's 16-bit grayscale.
>
>  $ file gcp.png
> gcp.png: PNG image data, 1024 x 768, 16-bit grayscale, non-interlaced
>
> I can reproduce, the blank white show() output,
> which clearly is a bug in PIL.
>
> PIL opens it in "I" mode
>  print im.mode
> which means "integer", but I don't know whether this is correct
> or not. Maybe "I;16" or so could be tried.
> See http://svn.effbot.org/public/tags/pil-1.1.4/libImaging/Unpack.c
> for possible modes.
>
> QuickFix: Make a JPG.
>
>  ...
>  im = Image.open('gcp.jpg')
>  ...
>
> Have a nice day,
> Matthias
>
> Am Samstag, den 04.02.2012, 10:58 -0500 schrieb Chris Mitchell:
>> Hey Nelson,
>>
>> Are you sure this image isn't actually a tiff (Every gel scanner I've ever
>> used outputs tiffs)?  Also, is it opening as an 8 bit image or a 16 bit?
>>  For a gel scan, it should be a 16 bit image, so you can consider forcing
>> the mode while opening it..
>>
>> Chris
>>
>> On Tue, Jan 31, 2012 at 1:38 PM, Nelson Tong
>> <tongsnelson.ise at gmail.com>wrote:
>>
>> > thanks for reply, Matthias,
>> >
>> > when I use "show()", the image appears to have an all-white
>> > background, nothing else is on it.  The size does indeed match the png
>> > size , I used the following to confirm:
>> >
>> >    x, y =  outIm.size
>> >    print "size of outImg: " + str(x)+" " + str(y);
>> >
>> > I tries to resave the png as a  png image with a different name using
>> > PIL and show() of the 2nd png image still appear to have all-white
>> > background with nothing on it.
>> >
>> > but If I open the images (both the 1st and the re-saved image ) with
>> > the command line command of "display", I can see the images via
>> > ImageMagick.
>> >
>> > Attached is example image which I am having problem with.  Can you
>> > reproduce the same problem I'm seeing with this image, possibly due to
>> > the png image being broken?
>> >
>> > -N.
>> >
>> >
>> > On 1/29/12, Matthias Bock <matthiasbock at users.sourceforge.net> wrote:
>> > > Am Freitag, den 27.01.2012, 11:11 -0500 schrieb Nelson Tong:
>> > >
>> > >>  outI = Image.open( fileOutPNGFile )
>> > >>  outI.show();
>> > >>
>> > >> The code run without error, but the image return via X-windows  on my
>> > >> linux machine is a blank image, without visible graphic on it.
>> > >
>> > > What color is this "blank": Grey? White?
>> > > Does the size match the PNG size?
>> > >
>> > >> I am 100% positive that the image of fileOutPNGFile is not corrupted
>> > >> because I am able to open it via the web-browser.
>> > >
>> > > Web browsers can open corrupted image files.
>> > >
>> > >> I tried the same code another to open  another png file which I use
>> > >> PIL to draw and save as png.   The code above is able to open and
>> > >> show
>> > >> this png file properly.
>> > >
>> > > Sounds to me, as if the first PNG was broken.
>> > >
>> > > Try this:
>> > >
>> > >  outI = Image.open( fileOutPNGFile )
>> > >  outI.show()
>> > >  outI.save('test.png')
>> > >  out2 = Image.open('test.png')
>> > >  out2.show()
>> > >
>> > >> why might this happen?
>> > >
>> > > If the code doesn't help solving the issue,
>> > > could you send the PNG to the list?
>> > >
>> > > Cheers, Matthias
>> > >
>> > >
>
>
>


More information about the Image-SIG mailing list