Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
831 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  Enregistrement d'image jpg/png/gif

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Enregistrement d'image jpg/png/gif

n°620478
EpoK
Let's burn
Posté le 23-01-2004 à 17:50:23  profilanswer
 

Bonjour,
 
je possede un tableau de int pixels[], avec les valeurs des pixels d'une image. Pour avoir la valeur rgd de chaque pixel je doit faire :
 
pixels[i] >> 16 // rouge
pixels[i] >> 8 // vert
pixels[i] // bleu
 
et j'ai le rbg du pixel
 
maintenant je me demande comment crée une image a partir de ca et de la save en jpg ou png ougif (pour l'afficher sur une page htm)
 
voila j'ai tenter de créer une buffered image, et de faire des setPixel mais ca fait un peu nimporte quoi
 
des idées ?

mood
Publicité
Posté le 23-01-2004 à 17:50:23  profilanswer
 

n°620480
chrisbk
-
Posté le 23-01-2004 à 17:53:30  profilanswer
 

EpoK a écrit :


pixels[i] >> 16 // rouge
pixels[i] >> 8 // vert
pixels[i] // bleu
 


nan
 
 
(pixels[i]&0xFF0000) >> 16 // rouge
(pixels[i]&0xFF00) >> 8 // vert
(pixels[i]&0xFF) // bleu
 
 
maintenant tu sais pkoi ca fait n'imp

n°620482
EpoK
Let's burn
Posté le 23-01-2004 à 17:54:48  profilanswer
 

chrisbk a écrit :


nan
 
 
(pixels[i]&0xFF0000) >> 16 // rouge
(pixels[i]&0xFF00) >> 8 // vert
(pixels[i]&0xFF) // bleu
 
 
maintenant tu sais pkoi ca fait n'imp


 
ben pour sauver en ppm ca marche bien :/

n°620483
chrisbk
-
Posté le 23-01-2004 à 17:55:39  profilanswer
 

EpoK a écrit :


 
ben pour sauver en ppm ca marche bien :/


 
 
ben quand tu dis  
 
pixels[i] = bleu
et pixels[i]>>16 = rouge
 
tu vois pas un probleme qqpart ?

n°620492
EpoK
Let's burn
Posté le 23-01-2004 à 18:03:32  profilanswer
 

chrisbk a écrit :


 
 
ben quand tu dis  
 
pixels[i] = bleu
et pixels[i]>>16 = rouge
 
tu vois pas un probleme qqpart ?


 
ben ca marche

n°620494
chrisbk
-
Posté le 23-01-2004 à 18:04:28  profilanswer
 

EpoK a écrit :


 
ben ca marche


tu vois vraiment pas le pb de logique ?

n°620497
EpoK
Let's burn
Posté le 23-01-2004 à 18:06:20  profilanswer
 

BufferedImage bf = new BufferedImage(img.getWidth(), img.getHeight(), ??? );
 
quand je cré ma buffered image je doi spécifier koi en 3eme param ?

n°620499
chrisbk
-
Posté le 23-01-2004 à 18:06:55  profilanswer
 

chaipas
y veut quoi ?

n°620500
EpoK
Let's burn
Posté le 23-01-2004 à 18:07:08  profilanswer
 

chrisbk a écrit :


tu vois vraiment pas le pb de logique ?


 
si mais la fonction savePPM on me l'a fournit elle marche et elle fait comme ca :)

n°620501
EpoK
Let's burn
Posté le 23-01-2004 à 18:07:41  profilanswer
 

chrisbk a écrit :

chaipas
y veut quoi ?


 
ben un flag
 


static int TYPE_3BYTE_BGR  
          Represents an image with 8-bit RGB color components, corresponding to a Windows-style BGR color model) with the colors Blue, Green, and Red stored in 3 bytes.  
static int TYPE_4BYTE_ABGR  
          Represents an image with 8-bit RGBA color components with the colors Blue, Green, and Red stored in 3 bytes and 1 byte of alpha.  
static int TYPE_4BYTE_ABGR_PRE  
          Represents an image with 8-bit RGBA color components with the colors Blue, Green, and Red stored in 3 bytes and 1 byte of alpha.  
static int TYPE_BYTE_BINARY  
          Represents an opaque byte-packed 1, 2, or 4 bit image.  
static int TYPE_BYTE_GRAY  
          Represents a unsigned byte grayscale image, non-indexed.  
static int TYPE_BYTE_INDEXED  
          Represents an indexed byte image.  
static int TYPE_CUSTOM  
          Image type is not recognized so it must be a customized image.  
static int TYPE_INT_ARGB  
          Represents an image with 8-bit RGBA color components packed into integer pixels.  
static int TYPE_INT_ARGB_PRE  
          Represents an image with 8-bit RGBA color components packed into integer pixels.  
static int TYPE_INT_BGR  
          Represents an image with 8-bit RGB color components, corresponding to a Windows- or Solaris- style BGR color model, with the colors Blue, Green, and Red packed into integer pixels.  
static int TYPE_INT_RGB  
          Represents an image with 8-bit RGB color components packed into integer pixels.  
static int TYPE_USHORT_555_RGB  
          Represents an image with 5-5-5 RGB color components (5-bits red, 5-bits green, 5-bits blue) with no alpha.  
static int TYPE_USHORT_565_RGB  
          Represents an image with 5-6-5 RGB color components (5-bits red, 6-bits green, 5-bits blue) with no alpha.  
static int TYPE_USHORT_GRAY  
          Represents an unsigned short grayscale image, non-indexed).


Message édité par EpoK le 23-01-2004 à 18:08:16
mood
Publicité
Posté le 23-01-2004 à 18:07:41  profilanswer
 

n°620504
chrisbk
-
Posté le 23-01-2004 à 18:11:28  profilanswer
 

TYPE_INT_ARGB
 
 
(:sweat:)

n°620507
EpoK
Let's burn
Posté le 23-01-2004 à 18:13:22  profilanswer
 

chrisbk a écrit :

TYPE_INT_ARGB
 
 
(:sweat:)


 
ben j'avais déja mis ca
 
( :sweat: )

n°621494
meumeul
Stay Heavy
Posté le 25-01-2004 à 21:21:22  profilanswer
 

up

n°621500
nraynaud
lol
Posté le 25-01-2004 à 21:32:15  profilanswer
 

chrisbk a écrit :


nan
 
 
(pixels[i]&0xFF0000) >> 16 // rouge
(pixels[i]&0xFF00) >> 8 // vert
(pixels[i]&0xFF) // bleu
 
 
maintenant tu sais pkoi ca fait n'imp

nan, ça marche bien dans tous les cas ou tu écrases les bits de poids fort (mettage dans un byte, écriture octet par octet etc.).


---------------
trainoo.com, c'est fini

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  Enregistrement d'image jpg/png/gif

 

Sujets relatifs
[C#] [résolu] Comment afficher une image en plein écran ?[VB] Récupérer la résolution d'une image
Question de width d'image ie/momoRectification de paire d'image stéréoscopique
[PostgreSQL] - Recup l'id du dernier enregistrement dans ma fctPour un site web : faire changer l'image quand on passe la souris
mise a jour imageObtenir une image a partir d'une rotation d'une autre... [RESOLU]
Empecher l'enregistrement d'une imageattacher une image a un enregistrement sous windev
Plus de sujets relatifs à : Enregistrement d'image jpg/png/gif


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR