swfから画像を抽出するコマンドラインアプリケーション
Revision | 3cf9e5a2529d715f88c9ffe39b973d7f9cd85d7e (tree) |
---|---|
Zeit | 2016-09-14 22:45:08 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
出力ファイル名を'original-tagNumber'に変更した
@@ -11,6 +11,7 @@ | ||
11 | 11 | #import "HMZlibData.h" |
12 | 12 | |
13 | 13 | static NSString *sCurrentDir = nil; |
14 | +static NSString *originalName = nil; | |
14 | 15 | |
15 | 16 | void printLog(const char *fmt, ...) { |
16 | 17 | #if 0 |
@@ -41,7 +42,7 @@ void storeImage(const unsigned char *p, UInt32 length, int tagCount) { | ||
41 | 42 | return; |
42 | 43 | } |
43 | 44 | |
44 | - NSString *path = [NSString stringWithFormat:@"d%d.jpg", tagCount]; | |
45 | + NSString *path = [NSString stringWithFormat:@"%@-%d.jpg", originalName, tagCount]; | |
45 | 46 | path = [sCurrentDir stringByAppendingPathComponent:path]; |
46 | 47 | NSURL *url = [NSURL fileURLWithPath:path]; |
47 | 48 | [pic writeToURL:url atomically:YES]; |
@@ -120,7 +121,7 @@ void storeDefineBitsJPEG3(const unsigned char *p, UInt32 length, int tagCount) { | ||
120 | 121 | NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithData:tiffData]; |
121 | 122 | NSData *imageData = [rep representationUsingType:NSPNGFileType |
122 | 123 | properties:@{}]; |
123 | - NSString *path = [NSString stringWithFormat:@"d%d.png", tagCount]; | |
124 | + NSString *path = [NSString stringWithFormat:@"%@-%d.png", originalName, tagCount]; | |
124 | 125 | path = [sCurrentDir stringByAppendingPathComponent:path]; |
125 | 126 | NSURL *url = [NSURL fileURLWithPath:path]; |
126 | 127 | [imageData writeToURL:url atomically:YES]; |
@@ -150,6 +151,9 @@ int main(int argc, const char * argv[]) { | ||
150 | 151 | exit(-1); |
151 | 152 | } |
152 | 153 | |
154 | + originalName = [filePath lastPathComponent]; | |
155 | + originalName = [originalName stringByDeletingPathExtension]; | |
156 | + | |
153 | 157 | printHex(data.bytes); |
154 | 158 | |
155 | 159 | // ヘッダの処理開始 |