PhotoChooserTask: know where does the photo come from - windows-phone-7

I'm using PhotoChooserTask with showCamera set to true. My question is if it is possible to know where the photo comes from: the library or the user has taken a new photo.
What I want is to send the coordinates if the photo has just been taken.
I know I could put two buttons, one for choosing from the library and another to take a new photo, but I'd prefer to have it in a single button.
Thank you!

Does the photo contain EXIF metadata? Perhaps you could read the photo stream and load the EXIF metadata and figure out pic time, GPS coords, etc.

Related

I want to batch extract gps data (exif) then convert to address and save that text to a jpg

I have 1500 pictures that need the address where they were taken to be shown in the corner of the picture. I have the pictures geo-tagged.
I need help extracting the GPS data and converting that to an address.
Then getting that address and saving it into the picture in the bottom right corner. Can anyone help or point me in the right direction please?
You're going to need two things. First you need an application that will extract the EXIF data that you are interested in. You should be able to write this yourself as it is fairly simple to do. You will need the JPEG standard and just need enough of it to identify the markers; specifically the APPn markers. You are also going to need the EXIF and (possibly the) TIFF standards to figure out how to extract the data you need form the EXIF APPn marker.
Writing the information to the corner of the image is the tough part. There are probably command line applications that will allow you to do that already. If worst comes to worst, there are various language API's that will allow you to read a JPEG stream into a buffer; draw text to the buffer; then write the buffer back to a JPEG stream.
You will most likely need to use a programming language for this; I think Python would be suitable as it's easy to get started and has libraries needed for your task.
For example, in order to extract the location (coordinates) from the JPEG files you can use pyexiv2.
To transform those coordinates to addresses you need to use a geocoding service such as Google's Geocoding API - you can use their Python library directly or code your own using something like requests.
Now that you have the address data you can overlay that data onto images using Python's pillow library.
If you're looking for some code to get started let me shamelessly plug my own project called photomap; you can find code to read GPS information from images here: https://github.com/iticus/photomap/blob/master/handlers.py#L170

What are Default Picture Names from the Hardware Camera

I noticed that depending on how an image was taken or saved to the Windows Phone device, a different naming scheme may be used. For instance, a picture taken from the default camera application and saved to the Camera Roll will be WP_20131108_001.jpg, and a picture from screenshots would be wp_ss_20131108_0001.jpg, while the Saved Pictures album naming convention seems to be random based on where the picture came from. Is there a systematic naming scheme for pictures in different albums?
I need the ability to know when a picture was taken with my application or not in case it is used later (and it may be chosen from the PhotoChooserTask). I was thinking if there is no standard way to tell where a picture came from, then when saving an picture from my app I could put in a certain text value in the name and then check to see if a picture's name contains that text when being used in my app, and in that way flag to know whether a picture originally came from my application or not. Any suggestions?
You can use Album.Name functionality of Picture class to get the album name/source folder where the picture came from.And while saving in cameraroll or saved pictures you can provide a custom name for your picture.
fileName = "Camera_" + DateTime.Now;
MediaLibrary library = new MediaLibrary();
library.SavePictureToCameraRoll(fileName, stream);

Windows Phone - get location of Image

I have a camera app, and want to store the location of where the Image was taken.
I'm wondering what the best practice to implement this is?
I can think of two possible solutions;
1) Get the location directly from the Image. I'm not sure if this is how it works in Windows Phone, but perhaps the location is stored in the Image every time you take one. If so, it would be easy to get it directly from the image.
2) If not, implement a GeoCoordinateWatcher that starts when I open the camera view and stores the location after I've taken the photo and then stops.
The camera photos have no location tagged to it. You need to capture the image, then the attempt to get the gps location after the picture is taken and tag it to the image.

Javascript copy canvas state as image

Seen a good charts plugin I want to use:
http://www.jqplot.com/tests/stackedTests.php
But for my visitors, they may want to save this as an image (via right click, copy as image menu item) or alternatively a button that says save as image or something similar.
So is it possible to save the canvas in any given state as an image file?
I think toDataURL could help you :)
If you are willing to use a pre-made library, you can try using Canvas2Image.
Otherwise there are a few Canvas methods that Canvas2Image wraps around and explain in more detail in the above site, namely the toDataURL method in the Canvas object that returns the data base64 encoded in the image format that you require. It's not 100% cross-browser, I think, but it's the "right" way of getting it.

Showing points on my image map

This is my scenario in brief:
I am making a restaurant's website.
The restaurant owner will upload his restaurant's plan view image.(example: http://cache.smartdraw.com/examples/content/Examples/SmartDraw/Floor_Plans/Restaurant_Plans/Family_Restaurant_Plan_L.jpg) Then he will mark on the image were the tables available for booking are. These coordinates will be saved in my database.
The user on the other hand will be able to click on these points(tables) and book a table.
The image map coordinates will be created dynamically according to the points that were submitted by the restaurant owner. Therefore I cannot have an image with icons already on it.
Is there a way with which I can display some sort of icon on the image map where the coordinates are? In order to make the points visible for the user.
I can think of a few options:
Generate the image map on your server, using something like GD for PHP, and place the icons where you want them
Use Javascript/CSS to position the icons where you want the in the HTML page
Use Flash to dynamically generate the icons
I think you can use ItemizedOverlay in this case.

Resources