PNG issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PNG issue

Rainer M. Engel
Hello everyone,

there seems to be a problem with the png-built-in-compression which is
good to have but not to deactivate, at least I think.

The attached macro creates n-Files in a certain resolution. It occurred
to me on different systems, that images containing only black and white
pixels (binary) will most likely have this problem. In my passes up to 3
Images out of 2000 will not reopen in ImageJ. That doesn't mean they are
overall corrupt since PS and other Tools can open them.

What does the macro do?
1 Step: it creates n-Images inside of a user defined working folder
2 Step: these images are opened again

There are two optional settings (rotation and blur). It seems to me, the
more grey pixels there are, the more likely all will be fine.

What do you encounter?

Best regards,
Rainer


--
Rainer M. Engel, Dipl. Digital Artist
scientific|Media GbR
Pichelsdorfer Str. 143
13595 Berlin





--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

PNG_issue.ijm (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PNG issue

Rainer M. Engel
Am 27.08.2013 10:58, schrieb Rainer M. Engel:

> Hello everyone,
>
> there seems to be a problem with the png-built-in-compression which is
> good to have but not to deactivate, at least I think.
>
> The attached macro creates n-Files in a certain resolution. It occurred
> to me on different systems, that images containing only black and white
> pixels (binary) will most likely have this problem. In my passes up to 3
> Images out of 2000 will not reopen in ImageJ. That doesn't mean they are
> overall corrupt since PS and other Tools can open them.
>
> What does the macro do?
> 1 Step: it creates n-Images inside of a user defined working folder
> 2 Step: these images are opened again
>
> There are two optional settings (rotation and blur). It seems to me, the
> more grey pixels there are, the more likely all will be fine.
>
> What do you encounter?
>
> Best regards,
> Rainer
>
>


No one, nothing?

I know a similar, maybe the same issue (by sharing libraries) with
VirtualDub exporting to a png-image sequence. If the images are overall
grayscale.

As a note, if you run into the same issue like me, switch to BIO-Formats
for opening those images with ImageJ/Fiji; no solution but a working
procedure.

Thank you.
RME


--
Rainer M. Engel, Dipl. Digital Artist
scientific|Media GbR
Pichelsdorfer Str. 143
13595 Berlin

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: PNG issue

Rainer M. Engel
Wayne told me that more recent versions of JAVA (i.e. 1.6.0_43 or newer
1.7. i.e.) do not create that error.

If there happens something similar to you, there is a neat workaround,
since opening every image with BIO-Format (it would work!) is much
slower. In Windowless-Mode in my tests 25x slower.

Here is a Macro to detect, when there is a opening-error with ImageJ's
default functions and only then BIO-Format is used. When working with
the log-window, it doesn't clutter there either.

//-------------------------------------------------------------------
for (i=0; i<list1.length; i++) {
        showProgress(i+1, list1.length);
        actSource = dir1+list1[i];

        snapLogA = getInfo("log");
        IJ.redirectErrorMessages();
        open(actSource);
        snapLogB = getInfo("log");
        if (snapLogA != snapLogB) {
                print("\\Clear");
                print(snapLogA);
                run("Bio-Formats (Windowless)", "open=&actSource");
        }
       
        //do processing ...

        run("Close All");
}

//-------------------------------------------------------------------

Maybe useful here and there..

Best regards,
Rainer


Am 29.08.2013 11:31, schrieb Rainer M. Engel:

> Am 27.08.2013 10:58, schrieb Rainer M. Engel:
>> Hello everyone,
>>
>> there seems to be a problem with the png-built-in-compression which is
>> good to have but not to deactivate, at least I think.
>>
>> The attached macro creates n-Files in a certain resolution. It occurred
>> to me on different systems, that images containing only black and white
>> pixels (binary) will most likely have this problem. In my passes up to 3
>> Images out of 2000 will not reopen in ImageJ. That doesn't mean they are
>> overall corrupt since PS and other Tools can open them.
>>
>> What does the macro do?
>> 1 Step: it creates n-Images inside of a user defined working folder
>> 2 Step: these images are opened again
>>
>> There are two optional settings (rotation and blur). It seems to me, the
>> more grey pixels there are, the more likely all will be fine.
>>
>> What do you encounter?
>>
>> Best regards,
>> Rainer
>>
>>
>
>
> No one, nothing?
>
> I know a similar, maybe the same issue (by sharing libraries) with
> VirtualDub exporting to a png-image sequence. If the images are overall
> grayscale.
>
> As a note, if you run into the same issue like me, switch to BIO-Formats
> for opening those images with ImageJ/Fiji; no solution but a working
> procedure.
>
> Thank you.
> RME
>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: PNG issue

Michael Schmid
In reply to this post by Rainer M. Engel
Hi Rainer,

sorry, I can't reproduce it in two runs with a total of more than 20000 repetitions (no blur, no rotate; result was "no issue occured.. hurray").
Java 1.6.0_51 (64 bit) on Mac OS X 10.6.8, ImageJ 1.48b and daily build.

One funny issue I noted: when writing, sometimes in the status line, I saw a flickering 'INTERRUPTED' - this might stem from the PlugInFilterRunner indicating that it sees an EscapeKeyPressed state - no idea why. Also EscapeKeyPressed should terminate the macro, but the macro continued.

As I can't reproduce it, maybe you could check for a possible race condition (insert 100 ms waiting between saving and Close All).

Another idea to find the reason for the problem:
Open one of the problematic files with some other software. Check whether the size is ok (4000x6000), save it under some other name and open in ImageJ. Make sure it is still 8 bits and same LUT, then save as PNG.
First see whether this PNG is now readable by ImageJ. If it isn't, probably the image contents and the PNG encoding are the problem.
If it is readable, check the length. Maybe the bad file was truncated at the end?

Hope this helps,

Michael
________________________________________________________________
On Aug 27, 2013, at 10:58, Rainer M. Engel wrote:

> Hello everyone,
>
> there seems to be a problem with the png-built-in-compression which is
> good to have but not to deactivate, at least I think.
>
> The attached macro creates n-Files in a certain resolution. It occurred
> to me on different systems, that images containing only black and white
> pixels (binary) will most likely have this problem. In my passes up to 3
> Images out of 2000 will not reopen in ImageJ. That doesn't mean they are
> overall corrupt since PS and other Tools can open them.
>
> What does the macro do?
> 1 Step: it creates n-Images inside of a user defined working folder
> 2 Step: these images are opened again
>
> There are two optional settings (rotation and blur). It seems to me, the
> more grey pixels there are, the more likely all will be fine.
>
> What do you encounter?
>
> Best regards,
> Rainer
>
>
> --
> Rainer M. Engel, Dipl. Digital Artist
> scientific|Media GbR
> Pichelsdorfer Str. 143
> 13595 Berlin
>
>
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> <PNG_issue.ijm>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: PNG issue

Rainer M. Engel
Hey Micheal,

I ran it on 32bit with JAVA 1.6.0_20 and on different 64bit 1.6.0_24
Windows systems and the error occurred every time. 2-3 files inside of
2000.

"javax.imageio.IIOExecption: Error reading PNG image data"
https://dl.dropboxusercontent.com/u/414433/imagej/png/png.zip

The Images themselves open well with BIO-Formats or PS for example.

> As I can't reproduce it, maybe you could check for a possible race condition (insert 100 ms waiting between saving and Close All).
I did that and had 9 errors in 5000 images.

Sincerely,
Rainer



Am 03.09.2013 11:33, schrieb Michael Schmid:

> Hi Rainer,
>
> sorry, I can't reproduce it in two runs with a total of more than 20000 repetitions (no blur, no rotate; result was "no issue occured.. hurray").
> Java 1.6.0_51 (64 bit) on Mac OS X 10.6.8, ImageJ 1.48b and daily build.
>
> One funny issue I noted: when writing, sometimes in the status line, I saw a flickering 'INTERRUPTED' - this might stem from the PlugInFilterRunner indicating that it sees an EscapeKeyPressed state - no idea why. Also EscapeKeyPressed should terminate the macro, but the macro continued.
>
> As I can't reproduce it, maybe you could check for a possible race condition (insert 100 ms waiting between saving and Close All).
>
> Another idea to find the reason for the problem:
> Open one of the problematic files with some other software. Check whether the size is ok (4000x6000), save it under some other name and open in ImageJ. Make sure it is still 8 bits and same LUT, then save as PNG.
> First see whether this PNG is now readable by ImageJ. If it isn't, probably the image contents and the PNG encoding are the problem.
> If it is readable, check the length. Maybe the bad file was truncated at the end?
>
> Hope this helps,
>
> Michael
> ________________________________________________________________
> On Aug 27, 2013, at 10:58, Rainer M. Engel wrote:
>
>> Hello everyone,
>>
>> there seems to be a problem with the png-built-in-compression which is
>> good to have but not to deactivate, at least I think.
>>
>> The attached macro creates n-Files in a certain resolution. It occurred
>> to me on different systems, that images containing only black and white
>> pixels (binary) will most likely have this problem. In my passes up to 3
>> Images out of 2000 will not reopen in ImageJ. That doesn't mean they are
>> overall corrupt since PS and other Tools can open them.
>>
>> What does the macro do?
>> 1 Step: it creates n-Images inside of a user defined working folder
>> 2 Step: these images are opened again
>>
>> There are two optional settings (rotation and blur). It seems to me, the
>> more grey pixels there are, the more likely all will be fine.
>>
>> What do you encounter?
>>
>> Best regards,
>> Rainer
>>
>>
>> --
>> Rainer M. Engel, Dipl. Digital Artist
>> scientific|Media GbR
>> Pichelsdorfer Str. 143
>> 13595 Berlin
>>
>>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html