从iPad应用中提取图像?

7

有没有办法从我下载的应用程序中提取图片?

在Android上我可以做到这一点,但iPad呢?

7个回答

15

是的。在“音乐/iTunes/移动应用”文件夹中找到app的.ipa文件。复制一份并将其重新命名为.zip文件。解压缩该文件。在Payload文件夹中,右键点击.app文件并选择“显示包内容”。现在您可以访问所有应用程序的资源。

PNG文件将被编码为iPhone格式,需要转换才能在您的Mac/PC上查看。有几个实用工具可供选择。

我使用了atPeek来自动完成整个过程,但这不是一个免费的应用程序(我想它价值5美元):http://www.atpurpose.com/atPeek/


如果您只是想在预览中查看PNG文件,则无需通过任何工具进行反向优化(或解码)文件。只需将PNG文件复制到任何位于.ipa文件夹外部的文件夹中(例如,在Downloads文件夹中),即可在预览中查看它们。但是,如果您想将PNG用于任何其他目的,则只需使用Xcode中提供的pngcrush工具。通过pngcrush进行反向优化(或解码)将减小图像的大小。 - Saurabh Hooda
如果你想访问应用程序的资源目录,你需要一些工具来查看编码版本 -- assets.car这个Mac应用程序对我很有帮助 - shoe

6

iOS SDK 3.2(及以上版本)开始,您可以使用pngcrush取消iOS PNG优化。

使用以下命令:

$ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations "~/Path/To/The/Apps.app/Image.png" "~/Path/To/Place/The/Reverted/Image.png"

完整信息请查看http://developer.apple.com/library/ios/#qa/qa1681/_index.html

iOS SDK可免费下载:http://developer.apple.com/devcenter/ios/index.action

您可以从http://pmt.sourceforge.net/pngcrush/下载pngcrush而无需下载iOS SDK。


3

3
在最新的Xcode中,路径如下:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush

因此,请确保您在“pngcrush”中编辑路径。
另外,对于初学者,如果收到“permission denied”错误消息,则是因为文件尚不可执行。请执行“chmod +x [filename]”。

1
  • 提取ipa文件的内容(根据@TomSwift的回答)

  • 我编写了这个PHP命令行脚本,它会转换/解压目录中的所有图像。这是一个命令行脚本,仅在OSX上进行测试。

参数:

--indir(包含PNG的目录)

--outdir(转换后的PNG将被放置的目录)

--pngcrushpath [可选](pngcrush路径,如果未指定,则默认为标准路径)

示例用法:

php uncrush.php --indir /MyIPAs/MyApp.app/ --outdir /MyIPAs/Converted/

脚本源代码:

<?php

$args = getopt('', array(
    'indir:',
    'outdir:',
    'pngcrushpath::'
));


$inDir = @rtrim($args['indir'], '/');
$outDir = @rtrim($args['outdir'], '/');
$pngCrushPath = isset($args['pngcrushpath']) ? $args['pngcrushpath'] : '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush';

if(!is_dir($inDir)){
    error('INPUT DIR IS NOT VALID - DIRECTORY NOT FOUND ' . $inDir);
}

if(!is_dir($outDir) && !mkdir($outDir)){
    error('OUTPUT DIR IS NOT VALID - DIRECTORY WAS NOT FOUND AND COULD NOT BE CREATED ' . $outDir);
}

if(!is_file($pngCrushPath)){
    error('PNGCRUSH BINARY NOT FOUND');
}

$pngs = glob($inDir . '/*.png');

foreach($pngs as $png){
    msg('CONVERTING - ' . $png);
    convert($png, $outDir . '/' . basename($png));
}

msg('DONE');
exit;


function error($str){
    $f = fopen('php://stderr', 'w');
    fwrite($f, $str . "\n");
    fclose($f);
    exit;
}

function msg($str){
    $f = fopen('php://stdout', 'w');
    fwrite($f, $str . "\n");
    fclose($f);
}

function convert($inPng, $outPng){
    global $pngCrushPath;

    exec($pngCrushPath . ' -revert-iphone-optimizations -q ' . $inPng . ' ' . $outPng);
}

?>

我今天写了这个脚本,希望它对其他人有用。请随意修改并在其他地方重新发布,但请链接回SO上的这个答案。

这正是我一直在寻找的!之前我遇到了一个Ruby脚本的问题。现在这个脚本运行得非常好 :) - Bryan

0
我发现从iPad/iPhone应用程序中直接访问设备并提取图像的最佳工具是iFunBox。在http://www.i-funbox.com/下载它。

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接