How does One place an image inside of an image using metadata? - iphone

For example, I can convert the second image into NSData and then place it inside metadata inside the first image and then when I open the first image and read the metadata I can get the NSData and turn it into an UIImage.
How would I go about doing this? All the metadata tags I see are not large enough to support another picture. I know picture in picture is quite common on desktop apps so I'm interested in getting it to work on the iPhone.
Is metadata the correct way to do this or is there another way?

Related

I want to store the characters in image. swift

I want to store the text in image.
I want to store text inside the image.
Is this possible? For example, the image contains various information such as location information.
I like to store my text inside the images like them.
I want to store the string inside the data of the image rather than the visual.
For example, you might want to store a small string that identifies the image in the image, so you want to separate it when you import the image.
I want to implement it in swift.
Your Q still leaks of information, what you really want to do. But I'll try to give you an answer, which might be a step to a better Q.
If you are talking about "inside" the image, you might mean inside the pixel data itself. It is possible to add data to an image without changing the image for humans. This is called a digital watermark or fingerprint. Typically this is used for DRM. You will find some information about this by using a search machine like Qwant.
But I do not think, that you really want to do this. Likely you want to add information in an image file. First of all you need a file format supporting additional data. Tiff is an example. AFAIK there is no build-in facility to get partial TIFF data for the image with ability to add private tasks. You have to create the file your own.

AlamofireImage: Is it possible to get the raw data from an NSimageview in Swift?

I am using an imagewell to accept jpg images being pasted or dragged into my OSX app. The problme is that I am struggling to get the original jpg images as OSX seems to requires me to get the Tiff version of the NSImage if I want to uplod via Alamo Fire.
Does AlamoFireImage have a fancy way of getting the original url / original raw data without converting to Tiff first?
Actually, with an NSImageWell, you don't have much possibilities regarding the dropped image. It's a convenient class for showing dropped images but as soon as you need to do more, it's not up to the task.
I suggest you use an NSImageView instead, and add drag and drop capabilities to it like in my example here: https://stackoverflow.com/a/29233824/2227743
This way you can easily get the dropped image's URL (and filename), and the image data itself of course.

UIImageView Image from NSURLConnection

I have a function that retrieves some images from a JSON feed using NSURLConnection. My connectionDidFinishLoading retrieves an array with all the data for that image (including the URL of the image).
What's the best way to display that image on a UIImageView? Even though the URL is being retrieved, I am pretty sure I would still have to display the image in a connection-friendly manner?
Thank you,
As per your requirement Images must be display in connection friendly manner. Then you can go for Image cacheing which requires image URLs. For your best understanding see this link and this link.
for asynchronous image downloading try with this link.

Linking to selected photos

If I allows users to select photos and need to store those selections (in a database), can I store a link to the selected photo or do I need to grab the image and store it in the app's Documents folder? The latter doesn't seem practical since it will cause the image to neednessly take up double the amount of space.
I'm familiar with UIImagePickerControllerDelegate but not sure how to obtain a reliable reference to an image that sustains across application restarts. There is probably the concern that the link can break if the user deletes that image from their photo library. Is there a way to check that?
There is no way to get a file url to an image stored in the Photo Library.
If you really do need to keep a reference to the file for programatic reasons, then choosing the image from UIImagePickerController and saving a copy to the Documents folder is probably your only option.
It would help if we could understand why you require a file reference to the image. As far as the iPhone is concerned, the image is safe and sound in the photo library, if user needs it, it can be picked from the image picker, like normal.
However, if you're trying to use it for a customisable background or something, then I think saving a copy is your only option.

iPhone - access location information from a photo

Is it possible, in an iPhone app, to extract location information (geocode, I suppose it's called) from a photo taken with the iPhone camera?
If there is no API call to do it, is there any known way to parse the bytes of data to extract the information? Something I can roll on my own?
Unfortunately no.
The problem is thus;
A jpeg file consists of several parts. For this question the ones we are interested in are the image data and the exif data. The image data is the picture and the exif data are where things like geocoding, shutter speed, camera type and so on are stored.
A UIImage (and CGImage) only contain image data, no tags.
When the image picker selects an image (either from the library or the camera) it returns a UIImage, not a jpeg. This UIImage is created from the jpeg image data, but the exif data in the jpeg is discarded.
This means this data is not in the UIImage at all and thus is not accessible.
I think the selected answer is wrong, actually. Well, not wrong. Everything it said is correct, but there is a way around that limitation.
UIImagePickerController passes a dictionary along with the UIImage it returns. One of the keys is UIImagePickerControllerMediaURL which is "the filesystem URL for the movie". However, as noted here in newer iOS versions it returns a url for images as well. Couple that with the exif library mentioned by #Jasper and you might be able to pull geotags out of photos.
I haven't tried this method, but as #tomtaylor mentioned, this has to be possible somehow, as there are a few apps that do it. (e.g. Lab).