Re: NSBitmapImageRep problem (I think)
Re: NSBitmapImageRep problem (I think)
- Subject: Re: NSBitmapImageRep problem (I think)
- From: Ondra Cada <email@hidden>
- Date: Fri, 19 Apr 2002 14:29:08 +0200
On Friday, April 19, 2002, at 02:14 , Brian Williams wrote:
Is it required that a NSBitmapImageRep be added to an NSImage instance?
It is not (or at the very least, it was not in MOSXS1). This simple tool
worked for me quite well:
#import <AppKit/AppKit.h>
int main (int argc, const char *argv[])
{
if (argc<2) {
printf("%s <file with TIFF data> G|P|J\n\nGif/Png/Jpeg data will
overwrite the orig.file\n",argv[0]);
} else {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *f=[NSString stringWithCString:argv[1]];
NSData *tiffData=[NSData dataWithContentsOfFile:f];
NSBitmapImageFileType
t=argv[2][0]=='G'?NSGIFFileType:argv[2][0]=='P'?NSPNGFileType:NSJPEGFileType;
if (!tiffData || ![[[NSBitmapImageRep imageRepWith
Data:tiffData]
representationUsingType:t properties:nil] writeToFile:f atomically:NO])
exit(1);
exit(0); // _E_nsure the process exit status is 0
}
return 0; // ...and make main fit the ANSI spec.
}
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.