Getting UIImage size when Image is picked from Photo Library - iphone

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

Related

Convert camera capture image like camscanner image flutter

I have implemented a app to capture image from camera and convert it to pdf and share that image.But I want to display camera captured image like on camscanner image using image processing, Can anyone suggest to dart library to do my task?
I have found a suitable answer for my requirement. I have used "edge_detection 1.0.5" package for detect edges for capture image so then final output will same as camscanner output.
https://pub.dev/packages/edge_detection

iPhone Image Loading in Photos Application

I am not sure if this is the right forum for asking this question, but I googled "questions related to iPhone" and the first page had SO from top to bottom. So here goes.
When I open the Photos Application in iPhone (3GS, 4 and 5 all running iOS 5.0) and open an image, first a blurred image appears for a fraction of a second, which clears up into the actual picture. My question is, does the Photo application have a low resolution copy of the high res images which it displays while the image is being loaded, OR does it generate a low res image on the fly before going on to load the high res image.
I am writing an application to browse through the photos, and need to know which is the best approach. That is the purpose behind this question.
The best way is using ALAsset thumbnail . If you have concerns with image clarity, then go with ALAsset fullResolutionImage
Here are some details that you must read before going to start developing an photos application.
An instance of ALAssetsLibrary provides access to the videos and photos that are under the control of the Photos application.
An ALAsset object represents a photo or a video managed by the Photo application.
There are different ALAsset Accessing Representations
1.thumbnail
Returns a thumbnail representation of the asset.
- (CGImageRef)thumbnail
2.aspectRatioThumbnail
Returns an aspect ratio thumbnail of the asset.
- (CGImageRef)aspectRatioThumbnail
3.defaultRepresentation
Returns an asset representation object for the default representation.
- (ALAssetRepresentation *)defaultRepresentation
4.representationForUTI:
Returns an an asset representation object for a given representation UTI.
- (ALAssetRepresentation *)representationForUTI:(NSString *)representationUTI
An ALAssetRepresentation object encapsulates one of the representations of a given ALAsset object.
1.CGImageWithOptions:
Returns a full resolution CGImage of the representation.
- (CGImageRef)CGImageWithOptions:(NSDictionary *)options
2.fullResolutionImage
Returns a CGImage representation of the asset.
- (CGImageRef)fullResolutionImage
3.fullScreenImage
Returns a CGImage of the representation that is appropriate for displaying full screen.
- (CGImageRef)fullScreenImage
Sample Code

Getting difficulty in reading image from Disk for iphone in Unity

I am developing a unity app, in which i call webservice for image url and after getting those url, i call one by one url for image downloading and store those images onto disks, and after in some point i read those images from disks and show as texture, but i am getting problem in reading images. It show me Question mark on texture and when i dig more to find out problem i got that i am getting zero of image using www.size and text also nil using www.text. I am doing following for reading and writing images.
Writing
if(wwwMarker.isDone)
File.WriteAllBytes(Application.persistentDataPath + "/"+ data.markerName + ".jpg", wwwMarker.bytes);
Reading
//fileurl is string which contain path of file
fileUrl = (Application.persistentDataPath + "/"+ markerDataObject.markerName + ".jpg");
if(System.IO.File.Exists(fileUrl))
if(www.isDone)
video.mIconPlane.renderer.material.mainTexture = imageToLoadPath.texture;
But when i read this code and show render image on texture it show me Question mark image, but when i load images from assets it works perfectly fine. Please help me that where i am doing wrong. I am nee bee in unity so thats why doing silly mistakes. This will be great for me. Thanks in advance.
Note, that unity's WWW can only dowload and save as textures JPG and PNG images. If you will try to download an image of any other format, you will get a red "?" image as result.

Is there a way to get paths of all the images of CAmera roll

Is there any way to create an array or something
having paths of all the images stored in camera roll.
Please enlighten me on this.
Thnx in advance
SpyPhone uses a direct path to the users photo library:
http://github.com/nst/spyphone/
It seems that any application can read it. However, this seems like falls under the area of "undocumented API" and could well be rejected in a real application.
I don't think there is. As far as the API is concerned for the UIImagePickerController you can only get a single path for a Movie that was recorded by the user (if running 3.0 on a 3GS). And even that path is a file URL to the temporary folder where the movie is stored before being written to the library.
You can't get paths for any images in the photo library or the camera roll.
When you pick an image using the UIImagePickerController the controller returns the Original Image and an "Edited Image" if the image was edited before being chosen.

Save photo to iphone camera roll with a custom name

I am trying to save a photo taken from my app to camera roll, this can be done by using UIImageWriteToSavedPhotosAlbum, however, I noticed there isn't any way to set the photo name by using this approach, am I right?
I also tried to save a image file with a name by using UIImageJPEGRepresentation, however, I can only save it to my app's document folder but not camera roll.
Is there any way to save photo to camera roll with a custom name?
Thanks advance for your kindly help.
John
no, no way to save with a custom name to the camera roll.
There is a way to kinda do that, by setting the image metadata:
if you set the IPTC metadata field "Object Name", this will be shown as the image title in iPhoto.
See details (and code) at http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/ .