comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Murray <w.h.oami@example.com>
Subject: Re: Question: re Image Files.
Date: Fri, 31 Aug 2012 08:18:27 +0100
Date: 2012-08-31T08:18:27+01:00	[thread overview]
Message-ID: <50406532$0$10734$5b6aafb4@news.zen.co.uk> (raw)
In-Reply-To: <7bd3df18-178b-4735-ac43-c6bb6df9e999@googlegroups.com>

On 30/08/2012 23:33, Austin Obyrne wrote:
 > Question: Is there any way by which I can reading in from an image 
file and operate on the individual pixels in a similar arithmetical way.

Yes, but you have to handle each individual image format (GIF, JPEG,
BMP etc) separately. This is a LOT of work to write a general program.
Either pick one type that you are going to use, or look at what you
are really doing and see if ther is not a way to generalise.

 > If not how are image files handled in Ada is there any transformation 
process?

Would I be correct in guessing that you are planning in reading these
files with the intention of encrypting the contents?

If so, then you can save yourself a MASSIVE amount of work by ignoring
the structure of the files, and simply reading them byte-by-byte. That
way you get a stream of numbers, all in the range 0-255, and as long
as the decryption process returns the numbers to exactly what the
original number was without missing or adding any, you can encrypt any
file you like.

There is demo code to do this here:
http://people.freebsd.org/~markm/raw_io.adb

(Disclaimer: I've not been using Ada for long; this program is likely
not particularly idiomatic use of the language; suggestions for 
improvement gratefully accepted).

M
-- 
Mark "No Nickname" Murray
Notable nebbish, extreme generalist.



  parent reply	other threads:[~2012-09-07  1:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 22:33 Question: re Image Files Austin Obyrne
2012-08-30 22:55 ` Adam Beneschan
2012-08-31  1:35 ` tmoran
2012-08-31  7:16 ` Dmitry A. Kazakov
2012-08-31  7:18 ` Mark Murray [this message]
2012-08-31  8:58   ` Austin Obyrne
2012-08-31  9:25     ` Ludovic Brenta
2012-08-31  9:41       ` Dmitry A. Kazakov
2012-08-31  9:14   ` Austin Obyrne
2012-08-31 17:09     ` Mark Murray
2012-08-31 17:36       ` Austin Obyrne
2012-08-31 22:09         ` Shark8
2012-09-04 10:05         ` Antti Louko
2012-08-31 21:12   ` gautier_niouzes
2012-09-01  6:58     ` Austin Obyrne
2012-09-03  6:02   ` Anatoly Chernyshev
2012-09-03  7:27     ` Mark Murray
2012-08-31  8:41 ` Brian Drummond
replies disabled

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