I want to store the characters in image. swift - 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.

Related

Sulu: Is it possible to get a resized image with custom meassures without a image format

is it in sulu possoble to get a resized image on the fly with custom dimensions, without the need to define an image fomrat before? A kind of "dynamic image format".
Reason is, that I would like to define multiple versions of an image based on some code calculations in order to fill the srcset attribute of an image.
Thx a lot!
Andreas
Not by default, but you might be able to override some parts of the FormatManager, but I am sure you would break some of Sulu's functionality that way (e.g. purging the cache for all image formats probably won't work anymore, or you can't manually crop that non-existing format). However, I have also not tested it, and I am not sure if that really works :-/

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.

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

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?

How to save multiple UIImage to a file iPad

I have a PDF reader that displays pages of the document. What I want to do is allow the user to draw over the PDF in a transparent view. Then I want to save the drawing (UIImage) to disk. If at all possible, I don't want to have the documents folder filled with files like documentName_page01.png, documentName_page02.png for every page that is drawn over.
However, I can't figure out how to store these UIImages into a single file without it becoming unwieldy and memory intensive.
Any ideas appreciated.
What is the user drawing, just lines, rectangles, circles and so on? Maybe store colors and paths of what needs to be drawn, put all of that into an NSArray and serialise that. That might be easier than trying to put multiple UIImages into a file, will use up less space on the device, and might be faster to load. Then just recreate the drawings.
Use Core Data to store your images in Binary Data fields and retrieve them from there. This way, you won't fill your Documents folder with images, no matter how many PDFs of how many pages you have. Here's a tutorial showing you how to do this.

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.