How can I recover PNG images from a .pvr.ccz file? - ios

I have an existing Cocos2D game that uses sprite images taken from a .pvr.ccz file, probably generated by TexturePacker. However, I don't have the original PNG images used to create that file, and I need to make some changes to the images in the game. Are there any tools or techniques that I can use to pull the images out of the .pvr.ccz file, or do I need to write my own tool?

Not possible if they use the encryption option of Texture Packer:
I've added a new feature to TexturePacker which helps you to prevent all this from happening. It's called ContentProtection and simply encrypts the images.
Your app will still be able to decrypt the data, but somebody else is going to have a hard time getting it done.
Source: https://www.codeandweb.com/texturepacker/contentprotection

Related

PDF image for iOS Assets

we can add image as pdf in ios assets for application.But i'm confusing that which approach is good for application.
Png file direct drag and drop to Assets
or use image as PDF
i have follows links
https://icons8.com/articles/how-to-use-vectors-in-xcode-7/
and https://bjango.com/articles/idontusepdfs/
but not able to decide which one is better solution for assets.
i know how to works with pdf asset but cannot decide which method is better from development point of view.
Thanks in advance.
If your artwork has complex gradients, generate the PNGs yourself. Otherwise, use PDFs. That's how I read it.
Personally, I have the luxury of working with a designer who just gives me assets at all the required sizes. On another project, Sketch was used which can auto-generate PNGs from a script as part of the build process. So I've never actually used PDFs.

Modifying JPEG Metadata without Recompressing Image in iOS

I'm trying to use
CGImageSourceCreateWithData
CGImageDestinationCreateWithData
and then
CGImageDestinationAddImageFromSource
but this discards any thumbnails or other embedded information in the original file. What I want to do is read in the file, alter its metadata, and write it out with the alterations only. But I'll settle for reading everything out of it, and putting it back again. Right now a 1.2MB image file gets converted to a 437kB file with the loss of additional data.
Is there something other than CGImage I can use? Can this even be done with the iOS API?
The problem you face is that the structure of the metadata depends upon the specific JPEG file format you are using.
You need to look at CGImageProperties. You're going to have to make sure the properties for your specific file format get copied as well.
What I was looking for was a read-modify-write operation for image files that allowed changes but otherwise maintained unaltered data. I've determined through research and testing that this is not possible in iOS. The closest mechanism available is CGImage processing, but this only allows you to read selected information from a source image (such as image, thumbnail, properties), and then use some of that information (image, properties) to create a new destination file. There's no way to include a thumbnail in the new destination file, and no way to get around recompressing the image.
As of iOS 7 you can use CGImageDestinationCopyImageSource "to modify EXIF and other image metadata in JPEG, PNG, PSD, and TIFF files without recompressing the image data"
https://developer.apple.com/library/archive/qa/qa1895/_index.html

"Fastest way to unzip many files on iOS" or "How else can I download many files quickly into my iOS app"

In my app i want the user to be able to download offline map content.
So I (compressed) moved all my tiles into a zip file. (I used 0 compression)
The structure is like that: {z/x/y.jpg}
+0
+-0
+--0.jpg
+1
+-1
+--0.jpg
+2
+-2
+--1.jpg
So basically there are going to be many many files for zoom level 0-15. (about 120.000 tiles for my test-region).
I am using https://github.com/mattconnolly/ZipArchive now but also tried out https://github.com/soffes/ssziparchive before and both are pretty slow. It takes about 5!! minutes on my iPhone 5S for the files to unzip.
Is there any way I can speed things up? What other possibilities rather than downloading the tiles in one big zip file would there be?
Edit:
How can i download the content of the whole folder quickly to my iPhone without the need of unzipping something?
Any help is appreciated!
JPGs rarely compress at all with zip - they are by definition already compressed. What you should do is create your own binary file format, and put whatever metadata you need into it along with the images (which you should encode with a really low quality number, to get their size down).
When you download those files, you can open then, quickly read them into memory, and extract out data or images as needed.
This will be really fast and have virtually no overhead if your extra data is binary (not text).
PS: I just tripped on a PHP Plist class
If anyone is wondering how I was ending up:
For my use-case (MapTiles) I am using MBTiles now instead of zipped images. It's one big database file and super easy to read if using FMDB. No unpacking whatsoever needed...
Even if I was placing the Images all in one binary file without any compression, the "extracting" still took forever!

Imagemagick integrated with Meteor

I am attempting to use Imagemagick to manipulate images that are uploaded by a user. Right now I have a simple set of Imagemagick.convert[ ] commands server side that preform a variety of tasks on the uploaded image. My problem comes from Imagemagick needing the file data to be read into meteor and not from a url. What I end up doing is writing the uploaded file to the /public folder where Imagemagick is able to manipulate the image. However because the list of Imagemagick.convert commands (saving and writing to /public), the application keeps refreshing, breaking up the processes and sending it into an infinite refreshing cycle. I don't think assets is a viable solution, but I need some folder that I can write to in meteor that will not interrupt the various Imagemagick processes through a refresh. I have tried the .folder for a hidden folder, but meteor gives me an error: "You can’t use a name that begins with a dot “.”, because these names are reserved for the system. Please choose another name." Any thoughts?
#Nate I wrote a little example app that solves this problem by using a temporary directory (as others have suggested):
https://github.com/ideaq/image-uploads
My solution gives you:
Easy image uploading in any Meteor app
Images are re-sized to Thumbnail, Mobile Optimised and Full-size Original
Images are uploaded to AWS S3 for CDN delivery (scalability and speed)
A thumbnail of the image is displayed on to the user without refreshing the page
if you found a better way of doing image uploads in meteor, please share! thanks. :-)

Writing Image to ALAssetsLibrary Results in a Different File Hash

I have an application that is downloading images from a server and inserting them into the iPhone's ALAssetsLibrary so that the user can see those images in their saved album. I am trying to do a confirmation by comparing file hashes to ensure the image was downloaded successfully. I have the file hash as the file exists on the server. Once I finish writing the image to the ALAssetsLibrary, I generate a file hash on the client. I'm observing that the file hashes are different but the files appear to be the same. I'm curious as to whether or not the client is altering these images somehow that I may not know about (aspect ratio, scale, metadata, etc). Any guidance, opinions, or advice would be helpful.
The image-data itself is not altered during import into the Assets-Library. However, I observed that JPEG files get about 10KB bigger, after they have been imported into the Assets-Library. The Assets-Library seems to add a JFIF-Metadata-Dictionary to the file, if not already present.

Resources