X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 08 Nov 2021 11:05 AM by  Ben Castellani
Fail to write PNG file
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Nicolas Slusarenko



New Member


Posts:2
New Member


--
28 Sep 2021 07:47 AM
    I have an IDL code that generates and saves several images in PNG format, running with IDL v7.0. Its working fine.
    I am testing the same code with IDL v8.8. The only problem I found is that the procedure WRITE_PNG fails.
    Both ones on Linux CentOS 7.0, 64 bits, x86.

    This is the error message I got,

    [error ] % WRITE_PNG: libpng warning: Application built with libpng-1.2.59 but running
    [error ] with 1.5.13
    [debug ] % WRITE_PNG: Unable to initialize the PNG library.

    For diagnostic, I made a small script with these lines and saved as 'png_test.idl'

    ; Create an image
    some_image = DIST(300)

    ; Write a PNG file
    filename = 'test.png'
    WRITE_PNG, filename, some_image, /VERBOSE

    If I execute the script with this command line,

    $ idl png_test.idl

    The PNG file is saved in disk but the interactive IDL shell is opened.
    If I execute the script with this other command line,

    $ idl -e png_test.idl

    The IDL shell in not opened, the file is not saved and I got this error,

    % Object reference type required in this context: PNG_TEST.
    % Execution halted at: $MAIN$

    Another diagnostic that I made: in my original code I replaced WRITE_PNG by WRITE_JPEG and it saves the images. It works.
    But, I want to generate the images in the PNG format, if possible.
    I would appreciate some help on this matter.
    Thanks,

    Nicolas Slusarenko

    Ben Castellani



    Basic Member


    Posts:130
    Basic Member


    --
    29 Sep 2021 09:55 AM
    It seems your IDL libpng is conflicting with libpng from your OS. IDL 8.8 ships with libpng included in the bin.linux.x86_64 directory. Is your IDL_DIR, IDL_PATH, and IDL_DLM_PATH environment variables defined properly? It seems like one of those is set to IDL 7.0 or incorrectly.

    From whatever IDL session you are getting the libpng warning, what is this output from:

    print, !version
    cd, current=c & print, c
    help, /pref, name='IDL_PATH'
    print, pref_get('IDL_PATH')
    print, !path
    print, getenv(/env), /implied



    P.S. If you use IDL "-e" at command line, you must provide a single line of code for IDL to execute. In your example, you are providing the filename. You need to provide the procedure or function name instead. You test script is a main-level program. Make it a procedure and try calling it.

    Nicolas Slusarenko



    New Member


    Posts:2
    New Member


    --
    18 Oct 2021 06:57 AM
    Thanks, Ben, for your ideas and advice.

    I have done the verifications that you suggested, which were all new to me. I found that all paths and variables are pointing to the correct location. But I agree with your diagnostic.

    I assume it happened this way: once I had the system running with IDL v7.0, I cloned that machine and replaced IDL with the newer version. Thus, I left some cross wiring messing with the IDL v8.8 installation.

    I would like to install it all again, including IDL v8.8, from scratch. I am sure this time will go better.

    Thanks, Ben,

    Nicolas

    Nicolas Slusarenko



    New Member


    Posts:2
    New Member


    --
    27 Oct 2021 08:53 AM
    Hi Ben,
    Finally, I installed the system from scratch.
    Unfortunately, I have the same error

    [error ] % WRITE_PNG: libpng warning: Application built with libpng-1.2.59 but running
    [error ] with 1.5.13

    The problem with the versions happened in the interaction of IDL with the operating system (OS), not with another version of IDL.
    The newest library "libpng-1.5.13" is the actual library of the OS. And IDL or some of its libraries is expecting "libpng-1.2.59".
    I installed an older version of libpng, but IDL pick the newest one.
    I cannot remove the newest one because many other programs depend on it.

    Thanks,
    Nicolas

    Ben Castellani



    Basic Member


    Posts:130
    Basic Member


    --
    08 Nov 2021 11:05 AM
    IDL 8.8.1 should be pulling its PNG from /usr/local/harris/idl88/bin/bin.linux.x86_64/idl_png.so which contains libpng version 1.6.37. I wouldn't expect IDL to be calling your OS libpng in this manner.

    I have no issues running your test code snippet in IDL 8.8.1 on CentOS 7.3. Have you tested your code snippet in IDLDE or command line? Inside those environments, the IDL bin directory gets appended to your system path and it's not possible that the OS libraries should get loaded before that.
    You are not authorized to post a reply.