Is there any gem to read exif data from png images - iphone

I am uploading png images from iphone. I would like to read the gps information from the image. I am using EXIF Reader(GitHub) but it works only for gif and tiff format.
Any solution to read Exif data from png images will be useful

exiftool supports PNG, and there are rubygems wrapping it:
multi_exiftool
mini_exiftool
I'm not sure what the difference between these two are, though.

ChunkyPNG supports this
img = ChunkyPNG::Image.from_file('image.png')
p img.metadata

Related

How to Use ffmpeg codes in iPHone

I need to convert the video into png images. I did that using ffmepg. But I need to do that quickly. Now it's taking lots of time to convert a video into images. Now to reduce the conversion time. I search lot But I got "ffmpeg -i video.mpg image%d.jpg" these codings as solution. Please teach me to use these kind of codings.
shoot and save the video with AVCaptureSession + AVCaptureMovieFileOutput
use AVAssetReader to extract the individual frames from the video as BGRA CVImageBufferRefs
save as PNG: CVImageBufferRef -> UIImage -> UIImagePNGRepresentation
This should be faster than ffmpeg because step 2 is hardware accelerated and also has the benefit of allowing you to discard a cumbersome LPGLed 3rd party library.
Enjoy!
with ffmpeg you can split video frame by frame and can mix audio with video and also check this

possible to create a video file from RGB frames using AV Foundation

I have an iOS app that I want to record some of its visual output into a video. It looks like the way to create a video on iOS is to use AVMutableComposition and feed AVAssets to it via insertTimeRange.
All the documentation and examples that I can find only add video and audio assets to an AVMutableComposition. Is there a way to add image data to it (i.e. add an image for each frame of the video)? I can get this image data as straight RGB, PNG, JPG, UIImage, or whatever is easiest to feed to AV Foundation (if it's even possible).
If it's not possible to feed images into an AVMutableComposition for the video frames, is there another way to generate an .mp4 file from frames in iOS.
To generate movies from frame you can use AVAssetWriter, here is a question that sort of covers that here on SO, question

memory leak when JPEG, not when PNG

My application aims at saving some user photos in a PDF file in order to send the file by email. To produce a small size pdf, I want to compress my images in jpeg. When I draw jpeg to the PDF context, the pdf file is indeed much smaller than when I use PNG, but the use of JPEG leaks.
For my debugging I added a jpeg and a png file to my project.
The following call leaks :
UIImage * destImage = [UIImage imageNamed:#"Image.JPG"];
[destImage drawInRect:drawingFrame];
whereas this one does not :
UIImage * destImage = [UIImage imageNamed:#"Image.png"];
[destImage drawInRect:drawingFrame];
Is there something I'm missing ? Is it a know issue ?
I'm thinking about a workaround that would consist in using a PNG representations of my images and set a specific compression option to the pdf I generate, but did not find this in the pdf generation sdk.
Do you have an idea about it ?
Thanks in advance.

Getting UIImage size when Image is picked from Photo Library

In my application I am uploading the image picked from Photo library. before uploading I need to show the size of image so that user will come to know how much data he need to transfer over network.
To Achive this I need to get Image size , I tried with UIImagePNGRepresentation,after this I am getting size in terms of some MBs,but when I dump image with data received from UIImagePNGRepresentation,size is shown in some KBs. why this is happening?
Does iOS internally compress the image data? how to get image path when picking image from photo library?
Thanks,
Sagar

ALAssetRepresentation as NSData for GIFs

I'm try to allow users to pull images out of their Photos collections using ALAssetsLibrary. Users can then upload these images. My goal is to allow users to upload any GIFs they may have in their library w/o loosing any animation they may have.
For PNG and JPEG files I can grab the ALAssetRepresentation, use - (CGImageRef)fullResolutionImage to get a CGImageRef, and then save it to NSData using UIImageJPEGRepresentation or UIImagePNGRepresentation.
However, because no similar function exists for GIF files, all I can do is covert the GIF to either JPEG or PNG, but then I lose the animation.
Is there either
a way to grab the NSData straight from an ALAssetRepresentation object or
a way to go from ALAssetRepresentation -> CGImageRef -> NSData without loosing any gif animation frames?
Thanks in advance!
Yes, there is a quite simple way:
Use the getBytes:fromOffset:length:error: method of ALAssetRepresentation. This gives youthe raw file data of the ALAsset, in your case the GIF file.