- 458 名前:名称未設定 mailto:sage [2008/06/28(土) 14:53:23 ID:xuSamy5I0]
- 別にPhotoshopなんか使わなくてもOS標準の機能で出来るし。
int main(int argc,char *argv[]) { NSApplicationLoad(); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int i; NSString *target = [NSString stringWithUTF8String:argv[1]]; PDFDocument *doc = [[PDFDocument alloc] initWithData:[NSData dataWithContentsOfFile:target]]; for(i=0;i<[doc pageCount];i++) { NSImage *img = [[NSImage alloc] initWithData:[[doc pageAtIndex:i] dataRepresentation]]; NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:[img TIFFRepresentation]]; [img release]; NSData *png = [rep representationUsingType:NSJPEGFileType properties:nil]; [png writeToFile:[NSString stringWithFormat:@"%@_%d.jpg",[target stringByDeletingPathExtension],i] atomically:YES]; } [doc release]; [pool release]; return 0; }
|
|