1

私はマック派で、

sipsを使用して PackBits 圧縮を取得する方法は?

以下の LZW は正常に動作します。

sips -s formatOptions lzw /DefaultGroup.tif

しかし、これは失敗します:

sips -s formatOptions packbits /DefaultGroup.tif

理由はありますか?

4

3 に答える 3

3

それ以外の

sips -s formatOptions packbits /DefaultGroup.tif

試す

sips -s formatOptions pacbits /DefaultGroup.tif

つまり、「packbits」の代わりに「pacbits」を使用します。

ちょっと意外ですが、あります。

于 2012-05-05T03:03:22.727 に答える
0

以下のコードは機能します。しかし、それでも私の質問に対する実際の答えは見つかりませんでした。

 int compression = NSTIFFCompressionPackBits;

CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)dataToWrite, NULL);

CGImageRef imageRef =  CGImageSourceCreateImageAtIndex(source, 0, NULL);

CFMutableDictionaryRef saveMetaAndOpts = CFDictionaryCreateMutable(nil,0,&kCFTypeDictionaryKeyCallBacks,  &kCFTypeDictionaryValueCallBacks);

CFMutableDictionaryRef tiffProfsMut = CFDictionaryCreateMutable(nil, 0,
&kCFTypeDictionaryKeyCallBacks,  &kCFTypeDictionaryValueCallBacks);

CFDictionarySetValue(tiffProfsMut, kCGImagePropertyTIFFCompression, CFNumberCreate(NULL, kCFNumberIntType, &compression));  
CFDictionarySetValue(saveMetaAndOpts, kCGImagePropertyTIFFDictionary, tiffProfsMut);

NSURL *outURL = [[NSURL alloc] initFileURLWithPath:filename];
CGImageDestinationRef dr = CGImageDestinationCreateWithURL ((CFURLRef)outURL, (CFStringRef)@"public.tiff" , 1, NULL);
CGImageDestinationAddImage(dr, imageRef, saveMetaAndOpts);
CGImageDestinationFinalize(dr);

CFRelease(dr);
[outURL release];
CFRelease(tiffProfsMut);
CFRelease(saveMetaAndOpts);
CFRelease(imageRef);

CFRelease(source);
于 2009-09-14T09:43:26.613 に答える
0

loopqoob そうですね。

sips の man ページは間違っています。sips を使用する場合は、「packbits」ではなく「pacbits」を使用する必要があります。

つまり、これは機能します。High Sierra を実行している私の Mac では次のようになります。

例えば

sips -s format tiff -s formatOptions pacbits '/Users/rob/Downloads/image20.jpg' --out '/Users/rob/Downloads/image20.tiff

その後、プレビューで tiff 画像を開くことができます。ドロップダウン メニューの [ツール] をクリックし、[インスペクタを表示] をクリックします。TIFF イメージが Packbits で圧縮されていることがわかります。(プレビューには、使用された圧縮の正しい名前が表示されます)。

于 2020-04-25T13:35:01.847 に答える