DNG image resolution iOS? - ios

I'm trying to figure out a way to read DNG image resolution without actually loading the image using CIFilter. So far I tried:
CGImageSourceCopyMetadataAtIndex - doesn't have any resolution info at all in returned dictionary
CGImageSourceCopyPropertiesAtIndex - has only resolution of the embedded preview image
What do I miss? I'm sure there are apps that read that info somehow or do they use 3d party libs like libexif?

Never mind. CIFilter does not process the image unless it's rendered. But the image properties are available immediately through CIImage

Related

Cropper.js canvas iphone image rotation

I am using cropper.js to crop an image. But it looks like when I am cropping the image in an iphone/ipad sometimes (not always) the canvas is rotated but only for portrait images. I searched and found out that it's a canvas issue with iOS. Is there any way that I could make it work ? I tried to used the exif metadata from the image and get the orientation but then I found that the not all the images have the exif metadata (some people can remove them and png images don't have those metadata at all). Any suggestions on how I could fix this rotation problem?

iOS image quality improvement

Icons Are Pretty Right?
I'm working on an UI update in an iOS app, and trying to make things look a bit better with some new icons- but I seem to be incapable of determining how to save an image correctly so that it looks good in the interface!
As you can see from this image, if I include a white background with the image it looks great. If I take those same images and use an alpha background they look terrible! It appears that either the images aren't using the #2x correctly, or something else is going horribly wrong.
These images are either saved with GIMP as a png with alpha, or exported from inkscape, the originals are vector graphics. We get the same results from both avenues. I am using both a base imageName.png and imageName#2x.png for scaling.
Somehow, magically, I changed the a single image to greyscale in gimp, and changed the base size to 25px and it showed up with alpha correctly blended. Stock images from apple are also functioning correctly, so it absolutely seems to be something that I'm doing incorrectly when I'm saving the images.
The Setup in XCode
Basic Questions
Is there a certain bit depth, argb vs rgba format, or some other quirk that I need to know to get these images to show up correctly? Is there any way to verify that the program is loading the correct imageName#2x vs imageName? Is there some document that talks about integrated graphics (the iconography documentation isn't very helpful on technical details)
Actual Images
With Background:
Without Background:
I think you will find success if you just save the image at 4x the size you actually want and specify the size manually.

Get image Properties in iPhone to check image quality

I'm capturing an image from the iPhone camera and storing it in the document folder for further check and use.
Before storing the image i want to check the image quality based on the RGB value, grayscale and white balance , etc.
All that i can get from the image. But i am not able to understand what should or how should i use any framework that would help me retrieve this information.
Any help would be appreciated.
Thank you!
This app may do what you want. It is called Photo Metadata Reader. I saw it had RGB in the screenshots.
https://itunes.apple.com/us/app/photo-metadata-reader/id437865801?mt=8
If you want to retrieve metadata from UIImage - check this
https://github.com/foundry/UIImageMetadata
If you want to get, for example, color balance, I think you must get pixel data from image and compute this by yourself

Save RGBA image with metadata in iOS

I am working on an iOS application that does some image processing.
The result of the processing is a grey-scale image.
When the process is finished, I want to save the original RGB image together with the result in a same image file to camera roll, so I thought of using alpha channel for that.
Also, I want to attach some parameters got in the processing as image metadata.
So here it comes my problem. I could not find an iOS compatible image format that allows saving alpha channel together with metadata.
On the one hand, JPEG images accept metadata, but not alpha channel.
On the other hand, PNG images accept alpha channel, but not metadata.
Any ideas?
Thanks in advance.
On the other hand, PNG images accept alpha channel, but not metadata.
But yes metadata.

Converting SVG into arbitrarily sized image on iOS

I have several SVG images that I would like to use in an iOS application, and, in short, I would like to turn the SVG images into UIImages (or CGImages).
My goal is that I should be able to load the images from the .svg files at an arbitrary size (assuming correct W/H ratio) and store them as UIImages or CGImages without any loss of image quality. (Note this all has to happen at runtime, pre-converting the images to various sized .png files and putting them in the App bundle isn't a viable option.)
Is this possible, and if so, how could I go about doing this? I have a good working knowledge of Core Graphics but I have never worked with vector graphics before.
SVGKit could help you - this library renders SVGs onto CALayer instances; from that, you can easily composite the image to a bitmap and make a CGImage of it.
I would not recommend converting a vectored document to a bitmap in most instances, but if you must SVGgh has a class SVGRenderer which has a method -(UIImage*)asImageWithSize:(CGSize)maximumSize andScale:(CGFloat)scale which will create a UIImage.
This is assuming SVGgh renders your SVGs properly, it doesn't support image effects, for instance.
#import <SVGgh/SVGgh.h>
-(UIImage) imageFromSVGURL:(NSURL*)svgURL withSize:(CGSize)maximumSize andScale:(CGFloat)scale
{
SVGRenderer* renderer = [[SVGRenderer alloc] initWithContentsOfURL:svgURL];
return [renderer asImageWithSize:maximumSize andScale:scale];
}

Resources