IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

[Image] Chargement d'images depuis TreeList


Sujet :

AWT/Swing Java

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Août 2006
    Messages
    43
    Détails du profil
    Informations personnelles :
    Localisation : France, Seine et Marne (Île de France)

    Informations forums :
    Inscription : Août 2006
    Messages : 43
    Par défaut [Image] Chargement d'images depuis TreeList
    Bonjour,
    Je reviens vers vous car j'ai une applette signée qui lit les images depuis un répertoire avec de nombreuses images dedans et qui les affiche dans un JPanel.
    Cela marche très bien pour quelques images mais des que je lit un répertoire avec de nombreuses images de bonnes qualité et bien il me met un message de Overflow Heap size.
    ça semble planté vers là.
    Je vous décrit la sinoptique du chargement des images depuis la classe Applet jusqu'a l'appel des classes Etendant JPanel
    //*********depuis l'applet
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    try {
    			File[] images = selectedFile.listFiles(imageIOFilter);
    			int imagesCount = 0;
    			for (File file : images) {
    				imagesCount += addImage(file);
     
    .......
    public int addImage(File file) {
    		int printed = 0;
    		try {
    			if (this.getJPanel().add(new ThumbnailPanel(file, 0, 0, true, true, this.imageIcon, this.imageIcon2)) != null) {
    				if (showImagesLoadingProgress)
    					this.getJPanel().paintAll(this.getJPanel().getGraphics());
    				printed = 1;
    			}
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return printed;
    	}
     
    // ********ensuite les JPanels ThumbnailPanel
     
    private JImagePanel createJImagePanel(File file, int x, int y, boolean autoSize, boolean keepAspect) throws IOException {
    		if (jImagePanel == null) {
    			jImagePanel = new JImagePanel(file, x, y, autoSize, keepAspect, DEFAULT_ALIGNEMENT);
     
    		}
    		return jImagePanel;
    	}
     
    //*********  autre JPanel   JImagePanel
    setImage(ImageIO.read(file));
    public void setImage(Image image) {
    		this.image = image;
    	}
     
    	public Image getImage() {
    		return this.image;
    	}
     
    	public void setImage(File file) {
    		try {
    			setImage(ImageIO.read(file));
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    Quelle méthode préconiseriez vous ?
    Merci de votre aide bonne soirée,
    Frederic

  2. #2
    Rédacteur

    Avatar de millie
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    7 015
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 7 015
    Par défaut
    Une image de bonne qualité, c'est quoi ?

    Car une image de taille : 2000*2000 prend en mémoire :
    2000²*4 octets au minimum : 15mo en mémoire.

    Donc, il suffit d'une cinquantaine d'image pour exploser le tas.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Août 2006
    Messages
    43
    Détails du profil
    Informations personnelles :
    Localisation : France, Seine et Marne (Île de France)

    Informations forums :
    Inscription : Août 2006
    Messages : 43
    Par défaut
    Bonjour
    Merci du retour,
    Ok mais comment faire ?
    Par rapport aux endroits où je récupère l'image comment faudrait traiter pour donner une taille et un poids minimum ?
    Merci infiniment de ton aide et de ton retour,
    Bonne journée,
    Bien cordialement,
    Frederic

  4. #4
    Rédacteur

    Avatar de millie
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    7 015
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 7 015
    Par défaut
    Tu les affiches comment tes images ?

    Tu ne peux pas créer des thumbnails ?


    Sinon, il faut éventuellement changer la taille du heap alloué par java (mais je ne sais pas comment faire avec une applet)

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Août 2006
    Messages
    43
    Détails du profil
    Informations personnelles :
    Localisation : France, Seine et Marne (Île de France)

    Informations forums :
    Inscription : Août 2006
    Messages : 43
    Par défaut
    Bonjour,
    mais pour faire un Thumbnail il faut réduire l'image initiale non ?
    Et c'est là où je pêche.
    Comme par rapport à mo code donnée ci-dessus je peux ne faire que de petites images qui s'ajoute au JPanel?
    Merci A++ bonne journée,
    Bien cordialement,
    Frederic

  6. #6
    Rédacteur

    Avatar de millie
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    7 015
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 7 015
    Par défaut
    J'espère que ça devrait t'aider.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    public static BufferedImage reduceImage(BufferedImage input, int newwidth,
    			int newheight) {
    		BufferedImage out = null;
    		//on choisie le type de couleur suivant le nombre de composants
    		if(input.getColorModel().getNumColorComponents() == 1)
    		 out = new BufferedImage(newwidth, newheight, BufferedImage.TYPE_BYTE_GRAY);
    		else
    			out = new BufferedImage(newwidth, newheight, BufferedImage.TYPE_INT_RGB);
     
    		Graphics2D g = out.createGraphics();
    		System.err.println("Temp color model : " + input.getColorModel());
    		Image scaled = input.getScaledInstance(newwidth, newheight,	Image.SCALE_SMOOTH); //on utilise un SCALE_SMOOTH pour obtenir une petite image correcte
    		g.drawImage(scaled, 0, 0, out.getWidth(), out.getHeight(), null);
    		g.dispose();
    		return out;
    	}
     
    	public static BufferedImage reduceImage(BufferedImage input, float factor) {
    		int newwidth = (int) (((double) input.getWidth()) * factor);
    		int newheight = (int) (((double) input.getHeight()) * factor);
    		return reduceImage(input, newwidth, newheight);
    	}

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Août 2006
    Messages
    43
    Détails du profil
    Informations personnelles :
    Localisation : France, Seine et Marne (Île de France)

    Informations forums :
    Inscription : Août 2006
    Messages : 43
    Par défaut
    Bonjour ,
    Merci du retour mais le message apparait après 4 images ajoutée dans le panel.

    Exception in thread "AWT-EventQueue-1" java.lang.OutOfMemoryError: Java heap space
    at java.awt.image.DataBufferInt.<init>(Unknown Source)
    at java.awt.image.Raster.createPackedRaster(Unknown Source)
    at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
    at java.awt.image.BufferedImage.<init>(Unknown Source)
    at test.JImagePanel.reduceImage(JImagePanel.java:65)
    at test.JImagePanel.reduceImage(JImagePanel.java:78)
    at test.JImagePanel.<init>(JImagePanel.java:107)
    at ThumbnailPanel.createJImagePanel(ThumbnailPanel.java:140)
    at ThumbnailPanel.initialize(ThumbnailPanel.java:83)
    at ThumbnailPanel.<init>(ThumbnailPanel.java:72)
    at ImagesBrowserApplet.addImage(ImagesBrowserApplet.java:240)
    at ImagesBrowserApplet.loadImages(ImagesBrowserApplet.java:207)
    at FileTree.valueChanged(FileTree.java:310)
    at javax.swing.JTree.fireValueChanged(Unknown Source)
    at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source)
    at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
    at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
    at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown Source)
    at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(Unknown Source)
    at javax.swing.JTree.setSelectionPath(Unknown Source)
    at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(Unknown Source)
    at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(Unknown Source)
    at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressedDND(Unknown Source)
    at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

    Mon code source de mon JPanel est le suivant.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
     
    package test;
     
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.Shape;
    import java.awt.Toolkit;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
     
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.event.IIOReadProgressListener;
    import javax.imageio.event.IIOReadUpdateListener;
    import javax.imageio.event.IIOReadWarningListener;
    import javax.imageio.stream.ImageInputStream;
    import javax.swing.JPanel;
     
     
    public class JImagePanel extends JPanel  {
     
     
    	// Alignements possibles de l'image dans son conteneur
    	public static enum Alignment {
    		NONE, LEFT, CENTER, RIGHT
    	};
     
    	// Dimension par défaut du conteneur
    	private static int width = 100;
    	private static int height = 100;
     
    	// Proriétés du composant
    	private Image image;
    	private int x;
    	private int y;
    	private boolean autoSize;
    	private boolean keepAspect;
    	private Alignment alignment;
     
    	// ************    ajout des variables de Champs de RotateImage   **************//
    	//private Image image;
    	   private Image imageIcon, imageIcon2;
    	   private double currentAngle;
    	   private Shape shape;
    	   private Graphics2D g2d;
    	   private Color color, colorInit;
    	private int xClip;
    //*******************************************************************************
     
    	public BufferedImage reduceImage(BufferedImage input, int newwidth,
    			int newheight) {
    		BufferedImage out = null;
    		//on choisie le type de couleur suivant le nombre de composants
    		if(input.getColorModel().getNumColorComponents() == 1)
    		 out = new BufferedImage(newwidth, newheight, BufferedImage.TYPE_BYTE_GRAY);
    		else
    			out = new BufferedImage(newwidth, newheight, BufferedImage.TYPE_INT_RGB);
     
    		//Graphics2D g = out.createGraphics();
    		//System.err.println("Temp color model : " + input.getColorModel());
    		Image scaled = input.getScaledInstance(newwidth, newheight,	Image.SCALE_SMOOTH); //on utilise un SCALE_SMOOTH pour obtenir une petite image correcte
    		//g.drawImage(scaled, 0, 0, out.getWidth(), out.getHeight(), null);
    		//g.dispose();
    		return out;
    	}
     
    	public BufferedImage reduceImage(BufferedImage input, float afactorctor) {
    		int newwidth = (int) (((double) input.getWidth()) * afactorctor);
    		int newheight = (int) (((double) input.getHeight()) * afactorctor);
    		return reduceImage(input, newwidth, newheight);
    	}
    //***********************************************************************************
    	public JImagePanel(File file, int x, int y, boolean autoSize,
    			boolean keepAspect, Alignment alignment) throws IOException {
    		super();
    		setSize(new Dimension(width, height));
    	Image image =eader.read(0);
    		//setImage(ImageIO.read(file));
    		setImage(this.reduceImage(ImageIO.read(file), 0.5f));
    		//setImage(image);
    		setX(x);
    		setY(y);
    		setAutoSize(autoSize);
    		setKeepAspect(keepAspect);
    		this.alignment = alignment;
     
    		//this.rotate();
    	}
     
    	public JImagePanel(File file, int x, int y, boolean autoSize)
    			throws IOException {
    		this(file, x, y, true, false, Alignment.NONE);
    	}
     
    	public JImagePanel(File file, int x, int y) throws IOException {
    		this(file, x, y, true);
    	}
     
    	public JImagePanel(File file) throws IOException {
    		this(file, 0, 0, true);
    	}
     
    	public JImagePanel(Image image, int x, int y, boolean autoSize,
    			boolean keepAspect) {
    		super();
     
    		setImage(image);
    		setX(x);
    		setY(y);
    		setAutoSize(autoSize);
    		setKeepAspect(keepAspect);
    	}
     
    	public JImagePanel(Image image, int x, int y, boolean autoSize) {
    		this(image, x, y, true, false);
    	}
     
    	public JImagePanel(Image image, int x, int y) {
    		this(image, x, y, true);
    	}
     
    	public JImagePanel(Image image) {
    		this(image, 0, 0, true);
    	}
     
    	public JImagePanel() {
    		super();
    		setX(0);
    		setY(0);
    		setImage((Image) null);
    		setAutoSize(false);
    	}
     
    	public void setImage(Image image) {
    		this.image = image;
    	}
     
    	public Image getImage() {
    		return this.image;
    	}
     
    	public void setImage(File file) {
    		try {
    			setImage(ImageIO.read(file));
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
     
    	public void setX(int x) {
    		this.x = x;
    	}
     
    	public void setY(int y) {
    		this.y = y;
    	}
     
    	public void setAutoSize(boolean autoSize) {
    		this.autoSize = autoSize;
    	}
     
    	public void setKeepAspect(boolean keepAspect) {
    		this.keepAspect = keepAspect;
    	}
     
    	public void paintComponent(Graphics g) {
     
    		super.paintComponent(g);
     
    		if (image != null) {
    			//************   ajout du code de rotate  ***********************
    			g2d = (Graphics2D)g;
     
    		     AffineTransform origXform = g2d.getTransform();
    		     AffineTransform newXform = (AffineTransform)(origXform.clone());
    		     //center of rotation is center of the panel
    		     int xRot = this.getWidth()/2;
    		     int yRot = this.getHeight()/2;
    		     newXform.rotate(Math.toRadians(currentAngle), xRot, yRot);
    		     g2d.setTransform(newXform);
    		     //draw image centered in panel
    		     //int x = (getWidth() - image.getWidth(this))/2;
    		     //int y = (getHeight() - image.getHeight(this))/2;
    		     //g2d.drawImage(image, x, y, this);
     
    			//***************************************************************
     
    			// Gestion de la dimension d'affichage
    			Double scaleWidth = 0.0;
    			Double scaleHeight = 0.0;
    			if (autoSize) {
    				scaleWidth = new Double(getWidth())
    						/ new Double(image.getWidth(null));
    				scaleHeight = new Double(getHeight())
    						/ new Double(image.getHeight(null));
    				if (keepAspect) {
    					if (scaleWidth > scaleHeight) {
    						scaleWidth = scaleHeight;
    					} else {
    						scaleHeight = scaleWidth;
    					}
    				}
    			}
     
    			// Gestion de l'alignement d'affichage
    			double imageWidth = image.getWidth(null) * scaleWidth;
    			double imageHeight = image.getHeight(null) * scaleHeight;
     
    			switch (alignment) {
     
    			case LEFT:
     
     
     
     
    				setX(0);
    				break;
     
    			case CENTER:
     
    				Dimension dim = getSize();
    				double x = 0;
    				double y = 0;
     
    				if (dim.getWidth() > imageWidth) {
    					x = (dim.getWidth() - imageWidth) / 2;
    				}
     
    				if (dim.getHeight() > imageHeight) {
    					y = (dim.getHeight() - imageHeight) / 2;
    				}
    				setX((int) x);
    				setY((int) y);
    				scaleWidth = 1.0;
    				scaleHeight = 1.0;
    				break;
     
    			case RIGHT:
     
    				setX((int) (getSize().getWidth() - new Double(image
    						.getWidth(this)
    						* scaleWidth).intValue()));
    				scaleWidth = 1.0;
    				scaleHeight = 1.0;
    				break;
    			}
     
    			// Dessin de l'image
    			if (!autoSize) {
    				g.drawImage(image, x, y, image.getWidth(null), image
    						.getHeight(null), null);
    				//System.out.println("passage ici ");
    			} else {
    				//Graphics2D g2d = (Graphics2D) g;
    				g2d.scale(scaleWidth, scaleHeight);
    				if (alignment == Alignment.LEFT)
    					g2d.drawImage(image, x, y, null);
    				else
    					g2d.drawImage(image, x, y, (int) imageWidth,
    							(int) imageHeight, null);
     
    				g2d.setTransform(origXform);
    			     //** définition d'une zone graphique pour l'affichage d'un nouveau symbol**/
    			     g2d.setClip(x, 5, 75,40);
    			     this.shape=  g2d.getClipRect() ;
    			     //on recupère la dimension de la zone des icones pour gérer le sens de rotation
    			     xClip = (x+(this.shape.getBounds().width)/2);
    			     g2d.setColor(this.color);
    			     g2d.drawImage(imageIcon,x,5,this);
    			     g2d.drawImage(imageIcon2,x+40,5,this);
    			}
    		}
     
     
    	}
     
    	//**************      ajout du code Rotate  Applet ***********************//
    	public void rotate() {
    	     //rotate 5 degrees at a time
    	     currentAngle+=90.0;
    	     if (currentAngle >= 360.0) {
    	       currentAngle = 0;
    	     }
    	     repaint();
    	   }
     
    	   public void rotateAnti() {
    		     //rotate 5 degrees at a time
    		     currentAngle+=-90.0;
    		     if (currentAngle >= 360.0) {
    		       currentAngle = 0;
    		     }
    		     repaint();
     
    		   }
     
    	   public void changeColor(Color c){
     
    		   this.color = c;
     
    		     repaint();
    		     System.out.println("changeColor()");
    	   }
    	   //* changement de l'icone du sens de rotation en haut de l'image principale ***/
    	   public void changeImageIcon(Image img, Image img2){
     
    		   this.imageIcon =img;
    		   this.imageIcon2 =img2;
    		     repaint();
    		     System.out.println("changeImage()");
    	   }
     
     
    	   public Color getInitColor(){
    		   return this.colorInit;
    	   }
     
     
     
     
     
     
     
     
    	   public Shape getShape(){
    		   return this.shape;
    	   }
     
    	   // gestion de la rotation a gauche de l'image
    	   public boolean isInsideLeftShape(double x, double y){
    		   //System.out.println(" isInsideShape   "+xClip+"   "+Math.round(x));
    		   if(this.shape.contains(x, y) && Math.round(x)< this.xClip){
     
    			  return true;
    		   }
     
    		   else return false;
    	   }
     
    	// gestion de la rotation a droite de l'image
    	   public boolean isInsideRightShape(double x, double y){
    		   //System.out.println(" isInsideShape   "+xClip+"   "+Math.round(x));
    		   if(this.shape.contains(x, y) && Math.round(x)> this.xClip){
     
    			  return true;
    		   }
     
    		   else return false;
    	   }
     
    	public void imageUpdate(ImageReader arg0, BufferedImage arg1, int arg2,
    			int arg3, int arg4, int arg5, int arg6, int arg7, int[] arg8) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void passComplete(ImageReader arg0, BufferedImage arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void passStarted(ImageReader arg0, BufferedImage arg1, int arg2,
    			int arg3, int arg4, int arg5, int arg6, int arg7, int arg8,
    			int[] arg9) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void thumbnailPassComplete(ImageReader arg0, BufferedImage arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void thumbnailPassStarted(ImageReader arg0, BufferedImage arg1,
    			int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
    			int arg8, int[] arg9) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void thumbnailUpdate(ImageReader arg0, BufferedImage arg1, int arg2,
    			int arg3, int arg4, int arg5, int arg6, int arg7, int[] arg8) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void imageComplete(ImageReader arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void imageProgress(ImageReader arg0, float arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void imageStarted(ImageReader arg0, int arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void readAborted(ImageReader arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void sequenceComplete(ImageReader arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void sequenceStarted(ImageReader arg0, int arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void thumbnailComplete(ImageReader arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void thumbnailProgress(ImageReader arg0, float arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	public void thumbnailStarted(ImageReader arg0, int arg1, int arg2) {
    		// TODO Auto-generated method stub
     
    	}
    En fait pour utiliser les deux fonction que tu m'as ecrite je passe la valeur suivante
    this.image = this.reduceImage(ImageIO.read(file), 0.008f);
    et je pense que c'est le ImageIO.read(file) qui plante mais je ne sais pas ??
    Merci de ton aide.
    Bien cordialement,
    Fred

Discussions similaires

  1. [Débutant] Manipulation d'images : intégrer une image dans une image
    Par noscollections dans le forum VB.NET
    Réponses: 2
    Dernier message: 17/10/2014, 12h51
  2. [xhtml][css] chargement d'image sur IE
    Par killgors dans le forum Mise en page CSS
    Réponses: 4
    Dernier message: 23/08/2005, 21h37
  3. chargement d'image
    Par bakonu dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 20/06/2005, 23h40
  4. [JLabel] Chargement d'image dans une JFrame
    Par mr.t dans le forum Composants
    Réponses: 10
    Dernier message: 27/01/2005, 19h32
  5. Réponses: 21
    Dernier message: 29/04/2004, 16h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo