2011-09-25 39 views

回答

1

這樣的事情,蘋果的圖像API都不會是夠你所需要的。但是,有幾個第三方API可以與iPhone配合使用。 Libraw是一個很好的我發現有一個C接口。由於Objective-C是C的嚴格超集,因此您可能可以在iOS應用程序中使用它。

從我在他們的文檔看,你也許可以寫一個CR2圖像爲TIFF,然後將其作爲這樣一個UIImage解碼:

NSString * cr2Path = @"path/to/cr2/file"; 
NSString * tiffPath = [NSTemporaryDirectory stringByAppendingPathComponent:@"x.tiff"]; 

libraw_data_t * cr2Data = libraw_init(0); 
libraw_open_file(cr2Data, [cr2Path UTF8String]); 
libraw_unpack(cr2Data); 
// setup encoding params 
cr2Data->params.output_tiff = 1; 
cr2Data->params.use_camera_wb = 1; 
// encode and write as tiff 
libraw_dcraw_process(cr2Data); 
libraw_dcraw_ppm_tiff_writer(cr2Data, [tiffPath UTF8String]); 
libraw_recycle(cr2Data); // free the memory 
// load the UIImage 
UIImage * myImage = [[UIImage alloc] initWithContentsOfFile:tiffPath]; 
// use myImage here ... 
[myImage release]; 

從我所看到的,它看起來像您將能夠download it here,然後將src/,libraw/,dcraw/internal/目錄中的src文件添加到您的Xcode項目中。希望你不會遇到任何奇怪的鏈接/編譯問題。