Enregistrer une image autrement qu'en "TIFF" |
Bienvenue invité ( Connexion | Inscription )
Il est interdit de poster directement à la racine de ce forum.
Veuillez créer votre topic dans le sous-forum approprié.
Enregistrer une image autrement qu'en "TIFF" |
Guest_Mic3D_* |
19 Jul 2004, 14:14
Message
#1
|
Guests |
Salut,
La question est résumée dans le titre. Que ce soit avec une NSImage, NSImageRep ou NSBitmapImageRep... je n'arrive jamais à créer une "image.jpg" ou autre "png", "gif", etc... Merci et bonne fin de journée -- Edition -- CODE NSBitmapImageRep *im=[NSBitmapImageRep imageRepWithData:[img TIFFRepresentation]];
NSData *d=[[NSData alloc] initWithData:[im representationUsingType:NSJPEGFileType properties:nil]]; Ce message a été modifié par Mic3D - 19 Jul 2004, 14:49. |
|
|
19 Jul 2004, 14:57
Message
#2
|
|
Macbidouilleur de bronze ! Groupe : Membres Messages : 291 Inscrit : 29 May 2004 Lieu : 48°50'27" N, 2°13'43" E Membre no 19 336 |
Bonjour,
CODE NSBitmapImageRep *rep;
NSData *inData, *outData; ... inData = [NSData dataWithContentsOfFile: <chemin vers fichier>]; rep = [NSBitmapImageRep imageRepWithData: inData]; outData = [rep representationUsingType: NSJPEGFileType properties: nil]; ... Ce message a été modifié par cbrandt - 19 Jul 2004, 14:58. -------------------- Membre no. 14 du club des AIPBP (Anciens Inscrits Pas Beaucoup de Posts) Voir la liste
|
|
|
19 Jul 2004, 17:52
Message
#3
|
|
Macbidouilleur d'Or ! Groupe : Membres Messages : 1 599 Inscrit : 20 Sep 2003 Membre no 9 702 |
La question m'intéresse aussi. J'ai essayé le bout de code suivant:
CODE #include <Cocoa/Cocoa.h> int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSBitmapImageRep *rep; NSData *inData, *outData; inData = [NSData dataWithContentsOfFile:@"/Users/arthur/Pictures/IMG_0944.JPG"]; rep = [NSBitmapImageRep imageRepWithData:inData]; outData = [rep representationUsingType:NSBMPFileType properties:[NSDictionary dictionary]]; NSLog(@"Sortie: %@", outData); [pool release]; return 0; } Quand je lance le programme, j'obtiens: CODE Sortie: (NULL) Je comprend pas pourquoi.... Ce message a été modifié par Arty - 19 Jul 2004, 17:52. -------------------- |
|
|
Nous sommes le : 24th September 2024 - 23:12 |