Conversion: from "Image" to "File" [message #456298] |
Mon, 30 May 2005 12:59 |
Eclipse User |
|
|
|
Originally posted by: bhbh.iyy.com
Hello,
I'm using swt libraries to handle images, and I need to convert an Image
into a File, and viceversa.
I could convert a file into an image :
Image img = new Image(null,file.getAbsolutePath());
but I sometimes get java.lang.OutofMemory exception, when the image is
really big.
I also need to do the viceversa, and I have NO clue how to convert an image
into a file. I mean I know you can do it using an ImageLoader and saving it,
but if possible, I'd like not to save it on hard disk.
Any hints?
Thanks a lot,
Larissa
|
|
|
Re: Conversion: from "Image" to "File" [message #456304 is a reply to message #456298] |
Mon, 30 May 2005 15:01 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
Try using -Xmx to increase the memory available to Java.
"Barli" <bhbh@iyy.com> wrote in message
news:d7f305$8ui$1@news.eclipse.org...
> Hello,
> I'm using swt libraries to handle images, and I need to convert an Image
> into a File, and viceversa.
> I could convert a file into an image :
> Image img = new Image(null,file.getAbsolutePath());
> but I sometimes get java.lang.OutofMemory exception, when the image is
> really big.
>
> I also need to do the viceversa, and I have NO clue how to convert an
image
> into a file. I mean I know you can do it using an ImageLoader and saving
it,
> but if possible, I'd like not to save it on hard disk.
> Any hints?
> Thanks a lot,
>
>
> Larissa
>
>
|
|
|
|
|
Re: Conversion: from "Image" to "File" [message #456610 is a reply to message #456385] |
Sun, 05 June 2005 18:47 |
Eclipse User |
|
|
|
Originally posted by: bhbh.iyy.com
"Philippe Ombredanne" <pombredanne@nexb.com> ha scritto nel messaggio
news:d7lm5i$vm7$1@news.eclipse.org...
> "Barli" <bhbh@iyy.com> wrote in message
> news:d7lcoe$mak$1@news.eclipse.org...
> To save, use an ImageLoader, set its data with the ImageData of your Image
> Then call ImageLoader.save("yourfilename", SWT.IMAGE_"Format"):
>
> Something like that for Jpeg:
> ImageLoader imageSaver = new ImageLoader();
> ImageData idata = image.getImageData();
> imageSaver.data = new ImageData[]{idata};
> imageSaver.save("yourfilename.jpg", SWT.IMAGE_JPEG);
>
Thanks for the tip, but I don't want to save the image on hard disk!
I want to save it on a "file" in the sense of a file type java variable!
Any idea how to do it?
Many thanks,
Lari
|
|
|
Re: Conversion: from "Image" to "File" [message #456611 is a reply to message #456610] |
Sun, 05 June 2005 20:34 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
Barli wrote:
> Thanks for the tip, but I don't want to save the image on hard disk!
> I want to save it on a "file" in the sense of a file type java variable!
> Any idea how to do it?
> Many thanks,
Do you mean java.io.File? That's nothing but a path.
Bob
|
|
|
Re: Conversion: from "Image" to "File" [message #456907 is a reply to message #456611] |
Mon, 13 June 2005 08:46 |
Eclipse User |
|
|
|
Originally posted by: bhbh.iyy.com
"Bob Foster" <bob@objfac.com> ha scritto nel messaggio
news:d7vnk8$n2l$1@news.eclipse.org...
> Barli wrote:
>> Thanks for the tip, but I don't want to save the image on hard disk!
>> I want to save it on a "file" in the sense of a file type java variable!
>> Any idea how to do it?
>> Many thanks,
>
> Do you mean java.io.File? That's nothing but a path.
Yes, I mean java.io.File.
So when I want to save something on a "file" type, it has to be stored on
hard disk first? Because I have to give the path to the file object?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03547 seconds