comp.lang.ada
 help / color / mirror / Atom feed
From: ka@sorry.no.email (Kenneth Almquist)
Subject: Re: Representing image data
Date: Wed, 11 Mar 2009 21:12:41 GMT
Date: 2009-03-11T21:12:41+00:00	[thread overview]
Message-ID: <dPVtl.2650$%u5.1401@nwrddc01.gnilink.net> (raw)
In-Reply-To: 49b71100$1_6@news.bluewin.ch

Thanks for the responses.

> What sort of applications have you in mind?

Ideally, any application that uses raster image data.  The idea behind
row-at-a-time mode is that the application will read the data in each
row and store it in a format appropriate for the application.

The ability to read an entire image at once is based on the assumption
that the result will in a useable format for a lot of applications,
but that may be more true in C, where we are concerned with binary
compatibility rather than logical compatibility between types.

> There are various libraries, full Ada (at least for BMP, GIF, TGA & PPM) 
> or bindings, which support these usual formats.

I found ImageMagick, which Srini mentioned, and found two more libraries
listed on www.adapower.com.  Any suggestions of where else to look?

With ImageMagick the only way to change the pixel format is to
recompile the library, so the interface doesn't have to deal with
multiple pixel formats.  It uses Interfaces.C.Pointers to enable the
interface to return a pointer to an array of pixels; a solution that
the documentation acknowledges isn't very good.

PNG-IO, which reads PNG files, has functions to access the sample values:

    function Pixel_Value(F : PNG_File; R, C : Coordinate) return Natural;
    function   Red_Value(F : PNG_File; R, C : Coordinate) return Natural;
    function Green_Value(F : PNG_File; R, C : Coordinate) return Natural;
    function  Blue_Value(F : PNG_File; R, C : Coordinate) return Natural;
    function Alpha_Value(F : PNG_File; R, C : Coordinate) return Natural;

These functions are inlined, but require a fair amount of computation
because their behavior depends on the attributes of the image, which
have to be checked every call.

Open-image has declarations for the various pixel types, which seems
to be a workable approach, but I have to think about it some more.

			    Kenneth Almquist



  parent reply	other threads:[~2009-03-11 21:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 21:26 Representing image data Kenneth Almquist
2009-03-11  1:16 ` Gautier
2009-03-11  2:43   ` Srini -
2009-03-11 21:12   ` Kenneth Almquist [this message]
2009-03-11 22:39     ` tmoran
2009-03-12  2:38   ` Randy Brukardt
2009-03-11  9:00 ` Dmitry A. Kazakov
2009-03-11 15:45   ` Brian Drummond
2009-03-11 20:12     ` sjw
2009-03-13 11:31       ` Brian Drummond
2009-03-13 20:31 ` Kenneth Almquist
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox