From: Jose L. on
Hi,

I hope anyone help me with the next question.

I need save in a variable, the image resulting after apply imwrite function.
Because I need avoid write and read the image in the hard disk computer.

I try with this:

>> J=imwrite(I,'\image.jpg','jpeg','Quality',90);
??? Error using ==> imwrite
Too many output arguments.

But the result is not successful.

Someone could help me with this?

Thanks for your attention.
From: Walter Roberson on
Jose L. wrote:

> I need save in a variable, the image resulting after apply imwrite
> function. Because I need avoid write and read the image in the hard disk
> computer.
> I try with this:
>
>>> J=imwrite(I,'\image.jpg','jpeg','Quality',90);
> ??? Error using ==> imwrite
> Too many output arguments.
>
> But the result is not successful.
>
> Someone could help me with this?

There is no provision documented for that.

You could possibly find a Java JPEG writer and modify it to save to memory
instead of to disk.
From: Jose L. on
Walter Roberson <roberson(a)hushmail.com> wrote in message <hubl0r$q8r$1(a)canopus.cc.umanitoba.ca>...
> Jose L. wrote:
>
> > I need save in a variable, the image resulting after apply imwrite
> > function. Because I need avoid write and read the image in the hard disk
> > computer.
> > I try with this:
> >
> >>> J=imwrite(I,'\image.jpg','jpeg','Quality',90);
> > ??? Error using ==> imwrite
> > Too many output arguments.
> >
> > But the result is not successful.
> >
> > Someone could help me with this?
>
> There is no provision documented for that.
>
> You could possibly find a Java JPEG writer and modify it to save to memory
> instead of to disk.

Thanks for your answer.
From: ImageAnalyst on
You could also write it to a temporary disk file, then use fread() to
read it back in byte by byte into an array, so that you have all the
header bytes along with the image data. Of course that won't work if
you're not allowed to write anything to the hard drive. Why aren't
you allowed to read from or write to the hard drive? Is it some kind
of security thing? And if you can't write anything to the hard drive
then why do you want the exact disk format of the image file? What
would you do with it? If all you can do is display data but not read
it or write/save it, then using just the image array alone would be
sufficient - you shouldn't need all the format-specific stuff.
From: Walter Roberson on
ImageAnalyst wrote:
> And if you can't write anything to the hard drive
> then why do you want the exact disk format of the image file? What
> would you do with it?

The Subject: refers to the "result image". As JPeg with a compression factor
was involved, the saving process would be lossy, and there would be good
reasons to want to pull back the uncompressed version of the JPEG image and
(for example) compare it to the original. One might, for example, be wanting
to test the robustness of a watermark that one had placed in the image.