• Read data of an image file

    From ali_nouri91@yahoo.com@21:1/5 to All on Sat Nov 20 11:34:18 2021
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gary Scott@21:1/5 to ali_n...@yahoo.com on Sat Nov 20 14:16:52 2021
    On 11/20/2021 1:34 PM, ali_n...@yahoo.com wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?


    The easiest method I use is probably too expensive for you, but it is a
    tailor made Fortran GUI/graphics API for windows (www.gino-graphics.com
    just in case). Not super easy.

    But here are some hints perhaps for windows:

    https://stackoverflow.com/questions/4567875/how-would-i-load-a-png-image-using-win32-gdi-no-gdi-if-possible

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to ali_n...@yahoo.com on Sat Nov 20 19:41:39 2021
    On Sunday, November 21, 2021 at 6:34:20 AM UTC+11, ali_n...@yahoo.com wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?
    .
    There are examples of writing picture files in
    "Introduction to Fortran 90/95, Algorithms, and Structured Programming".
    The file is defined as direct access, unformatted, and with a record length of 1.
    For reading in a picture file, the array would be defined as CHARACTER(1).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ali_nouri91@yahoo.com@21:1/5 to Gary Scott on Sun Nov 21 00:23:37 2021
    On Saturday, November 20, 2021 at 11:46:56 PM UTC+3:30, Gary Scott wrote:
    On 11/20/2021 1:34 PM, ali_n...@yahoo.com wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?

    The easiest method I use is probably too expensive for you, but it is a tailor made Fortran GUI/graphics API for windows (www.gino-graphics.com
    just in case). Not super easy.

    But here are some hints perhaps for windows:

    https://stackoverflow.com/questions/4567875/how-would-i-load-a-png-image-using-win32-gdi-no-gdi-if-possible


    Thanks for your comment.

    I saw "www.gino-graphics.com" before, it is not the kind of thing that I want.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ali_nouri91@yahoo.com@21:1/5 to Robin Vowels on Sun Nov 21 00:26:29 2021
    On Sunday, November 21, 2021 at 7:11:40 AM UTC+3:30, Robin Vowels wrote:
    On Sunday, November 21, 2021 at 6:34:20 AM UTC+11, ali_n...@yahoo.com wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?
    .
    There are examples of writing picture files in
    "Introduction to Fortran 90/95, Algorithms, and Structured Programming".
    The file is defined as direct access, unformatted, and with a record length of 1.
    For reading in a picture file, the array would be defined as CHARACTER(1).

    Thanks for your comment.

    I know how to read data. But converting an image (especially a PNG) to an array is different.
    There is a structure for data. That structure makes reading difficult.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From FortranFan@21:1/5 to ali_n...@yahoo.com on Sun Nov 21 05:58:08 2021
    On Saturday, November 20, 2021 at 2:34:20 PM UTC-5, ali_n...@yahoo.com wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?

    @ali_n...@yahoo.com,

    You may also want to inquire about this at the Fortran Discourse site: https://fortran-lang.discourse.group/

    And also look into the growing effort toward a Fortran standard library and see if there are any options in there of interest to you regarding this (I've not checked), or even considering adding one to it:
    https://github.com/fortran-lang/stdlib

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to ali_n...@yahoo.com on Sun Nov 21 08:06:05 2021
    On Sunday, November 21, 2021 at 7:26:31 PM UTC+11, ali_n...@yahoo.com wrote:
    On Sunday, November 21, 2021 at 7:11:40 AM UTC+3:30, Robin Vowels wrote:
    On Sunday, November 21, 2021 at 6:34:20 AM UTC+11, ali_n...@yahoo.com wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?
    .
    There are examples of writing picture files in
    "Introduction to Fortran 90/95, Algorithms, and Structured Programming". The file is defined as direct access, unformatted, and with a record length of 1.
    For reading in a picture file, the array would be defined as CHARACTER(1).
    .
    Thanks for your comment.

    I know how to read data. But converting an image (especially a PNG) to an array is different.
    There is a structure for data. That structure makes reading difficult.
    .
    The image data is read into an array, as I described.
    Picture files usually have header information at the beginning of the file. With the data in the array, you process the bytes in the header to determine the file structure.
    You will need a specification of the PNG fomat in order to do that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Duffy@21:1/5 to ali_n...@yahoo.com on Mon Nov 22 00:09:08 2021
    ali_n...@yahoo.com <ali_nouri91@yahoo.com> wrote:
    I would like to read a PNG image file using Fortran and store the data
    in an array. Does anyone know a library or bunch of code or a blueprint for how to do that?

    Need to use C-interop to call libpng, or use another program to convert
    to ascii based format like Portable Bit Map using netpbm.

    A quick search also found me
    https://github.com/sage-git/forcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)