[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading images from internal char string

From: Mike Miller
Subject: Re: Reading images from internal char string
Date: Thu, 21 Jul 2016 10:19:49 -0700
User-agent: Mutt/1.6.0 (2016-04-01)

On Thu, Jul 21, 2016 at 00:39:49 -0700, PhilipNienhuis wrote:
> Hi,
> AFAIK (pls correct me if I'm wrong) Octave can only read images from file
> (or URL, essentially a file as well).
> I'd like to find a way to read images directly from a char string ("text
> file"). 
> For some assignment I need to process a long series of rain radar images in
> PNG format. 
> I haul them in using urlread() in "raw" (compressed) form, IOW the very same
> format in memory as it would be on disk.  To make an image out of them I
> haven't found a better way yet than to first write them in raw form to to
> disk (fopen, fwrite, fclose), only then to be able turn them into an image
> using imread() to read them back in as an image.  
> It would be a lot faster, and save disk space, if the output from urlread()
> could directly be interpreted and turned into an image while the "raw" image
> is still in memory, skipping disk I/O altogether.
> Is this possible at all?
> Stepping through imread.m I see that control finally passes to binary module
> __magickread__. All the way through there I only see references to real
> files.
> I saw the url option in imageIO.m but that also results in a file on disk
> that is fed to __magickread__ in the end.

I looked around a little, and as Pantxo said it seems that
GraphicsMagick will only read from a file. On unixy systems everything
is a file so that's not much of a limitation. I would just use a shared
memory file or a file in a tmpfs directory and it would be no different
from passing a memory buffer. I don't know if Windows has a concept of
being able to write a file in some way or in some directory so that it
is memory-backed instead of disk-backed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]