Per farle tornare normali bisogna usare il comando:
xcrun -sdk iphoneos pngcrush -revert-iphone-optimizations -q compresso.png nonCompresso.png
Ma come farlo dentro la APP?
Ecco il codice:
on mouseUp
-- CHECK FOR EXISTENCE OF PNGCRUSH UTILITY
put "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush" into crushPath
if there is not a file crushPath then
answer error "Unable to locate pngcrush tool. Check location of xCode."
exit mouseUp
end if
-- APPEND THE SHELL COMMAND PARAMETERSTO THE PNGCRUSH PATH
put crushPath && "-revert-iphone-optimizations -q source.png destination.png" into theCommand
-- ESTABLISH SOURCE AND DESTINATION FOLDERS
put directory into D -- store the current directory
answer folder "Locate folder containing PNG files:"
if the result is "Cancel" then exit mouseUp
put it into theSourceFolder
set directory to theSourceFolder
put the files into theList
set directory to D -- restore the directory
answer folder "Choose output folder:"
if the result is "Cancel" then exit mouseUp
put it into theDestinationFolder
-- PROCESS FILES
put 0 into theCount
repeat for each line theFile in theList
put theCommand into newCommand
if char -4 to -1 of theFile is not ".png" then next repeat -- ignore non-PNG files
put q(theSourceFolder & "/" & theFile) into theSourceFile
put q(theDestinationFolder & "/" & theFile) into theDestinationFile
replace "source.png" with theSourceFile in newCommand
replace "destination.png" with theDestinationFile in newCommand
get shell(newCommand)
wait 20 millisecs with messages
add 1 to theCount
put theCount -- show processed file count in message box
end repeat
answer "PNGs have been fixed!"
end mouseUp
function q pString
return quote & pString & quote
end q