• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

swfから画像を抽出するコマンドラインアプリケーション


Commit MetaInfo

Revision3cf9e5a2529d715f88c9ffe39b973d7f9cd85d7e (tree)
Zeit2016-09-14 22:45:08
Autormasakih <masakih@user...>
Commitermasakih

Log Message

出力ファイル名を'original-tagNumber'に変更した

Ändern Zusammenfassung

Diff

--- a/KanColleGraphicDivider/main.m
+++ b/KanColleGraphicDivider/main.m
@@ -11,6 +11,7 @@
1111 #import "HMZlibData.h"
1212
1313 static NSString *sCurrentDir = nil;
14+static NSString *originalName = nil;
1415
1516 void printLog(const char *fmt, ...) {
1617 #if 0
@@ -41,7 +42,7 @@ void storeImage(const unsigned char *p, UInt32 length, int tagCount) {
4142 return;
4243 }
4344
44- NSString *path = [NSString stringWithFormat:@"d%d.jpg", tagCount];
45+ NSString *path = [NSString stringWithFormat:@"%@-%d.jpg", originalName, tagCount];
4546 path = [sCurrentDir stringByAppendingPathComponent:path];
4647 NSURL *url = [NSURL fileURLWithPath:path];
4748 [pic writeToURL:url atomically:YES];
@@ -120,7 +121,7 @@ void storeDefineBitsJPEG3(const unsigned char *p, UInt32 length, int tagCount) {
120121 NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithData:tiffData];
121122 NSData *imageData = [rep representationUsingType:NSPNGFileType
122123 properties:@{}];
123- NSString *path = [NSString stringWithFormat:@"d%d.png", tagCount];
124+ NSString *path = [NSString stringWithFormat:@"%@-%d.png", originalName, tagCount];
124125 path = [sCurrentDir stringByAppendingPathComponent:path];
125126 NSURL *url = [NSURL fileURLWithPath:path];
126127 [imageData writeToURL:url atomically:YES];
@@ -150,6 +151,9 @@ int main(int argc, const char * argv[]) {
150151 exit(-1);
151152 }
152153
154+ originalName = [filePath lastPathComponent];
155+ originalName = [originalName stringByDeletingPathExtension];
156+
153157 printHex(data.bytes);
154158
155159 // ヘッダの処理開始