first i thank you for your attention.
I m working on a project that takes with a camera TIFF images (dimension 768*576) of a plan(1500 meters*1500 meters).
I want to paste the images of a region of interest in a big images to make effect on it after.
So i obtain image of 9000*9000 and i can't do that because i must affect memory size when i compile it and i don't know how i can't do that.
Sorry for my poor written langage but i'm not english...
Well I'm still not quite clear on your goal but how about creating thumbnails of the original images and making you larger picture out those?
Is this something that is interactive with a user? Does the user want to zoom in on the pictures or something?
What is the big picture (composite of the smaller ones) for, how will it be used?
The big picture is composite of the smaller ones:
it will be use (the big picture) with specific operation of the freeware imageJ.
Here is my code:
/**************************/
/***Biblioth鑡ues***/
/**************************/
import java.io.* ;
import java.util.* ;
import java.lang.* ;
import javax.swing.* ;
import java.awt.* ;
import java.awt.image.* ;
import javax.media.jai.* ;
import com.sun.media.jai.codec.* ;
public class ComposeImage extends JPanel
{
/**********************/
/***Attributs***/
/**********************/
/* dimension de l'image globale reconstitu閑 */
int width ;
int height ;
/* nom du fichier jpg qui repr閟ente l'image d'une r間ion reconstitu閑 */
String fileName ;
/* Nom de l'image globale reconstitu閑 */
String NomImageGlobale ;
/**************************************************/
/*** Constructeur de la classe programme***/
/**************************************************/
/* constructeur de la classe Programme */
public ComposeImage(int w,int h,String img)
{
try
{
this.width = w ;
this.height = h ;
this.NomImageGlobale = img ;
BufferedImage bufimg = new BufferedImage(this.get_width()*1,this.get_height()*1,BufferedImage.TYPE_INT_RGB) ;
Graphics g2D = bufimg.createGraphics();
Image imtemp1 = new ImageIcon("image3.jpg").getImage() ;
Image imtemp2 = new ImageIcon("image4.jpg").getImage() ;
g2D.drawImage(imtemp1,0,0,null) ;
g2D.drawImage(imtemp2,100,100,null) ;
g2D.dispose() ;
File file = new File(this.NomImageGlobale+".tif");
FileOutputStream out = new FileOutputStream(file);
TIFFEncodeParam param = new TIFFEncodeParam() ;
param.setCompression(TIFFEncodeParam.COMPRESSION_NONE) ;
ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF",out,param);
encoder.encode(bufimg);
out.close() ;
}
catch (Exception ex) {}
}
/**********************/
/***M閠hodes***/
/**********************/
/* retourne la valeur de la hauteur des images enregistr閑s par la cam閞a */
public int get_height() { return this.height ; }
/* retourne la valeur de la largeur des images enregistr閑s par la cam閞a */
public int get_width() { return this.width ; }
/* affecte une valeur ?la hauteur des images enregistr閑s par la cam閞a */
public void set_height(int s1) { this.height = s1 ; }
/* affecte une valeur ?la largeur des images enregistr閑s par la cam閞a */
public void set_width(int s2) { this.width = s2 ; }
}
It s just an exemple (hope you don't hate french langage!)
Well first off I think you want to use TYPE_USHORT_GRAY not TYPE_INT_RGB. That should dramtically reduce the amount of memory the image is going to take. So an 8 bit gray scale image at 10000x10000 should take 95.367 megs of memory.
Also you can increase the heap size available using the -Xmx command line option. I'm pretty sure that you specify the memory in kilobytes so -Xmx64000 is 64 thousand K or 64 meg. Try -Xmx128000 to make the heap 128 meg.
> I work on win2000
> i type: "C:\j2sdk1.4.0_01\bin>java -Xmx100m
> ComposeImageFrame.class"
> that gives: "Exception in thread "main"
> java.lang.NoClassDefFoundError:
> ComposeImageFrame/class"
c:\j2sdk1.4.0_01\bin> java -Xmx100m ComposeImageFrame
The .class is implied and actually problematic. If you type the .class, it thinks that "ComposeImageFrame" is a package and that you are attempting to execute the "class.class" file in that package.