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);
Related
Im trying to check if a screenshot contains an image that is saved in the project resources, I need to find a 100% match only and would like to not use any extra libraries, now with that being said, I have no idea how to do so.
heres a few questions:,
do I compare the two buffered images together? do I change them into something else?
Il have to compare it atleast once a second or so. (just as general information)
I have a resource folder under my project in eclipse and the .png files are shown as text, is there a way to change that? I tried tinkering with the settings, no luck yet.
public static BufferedImage screenshot(){
BufferedImage capture = robot.createScreenCapture(screenSize);
return capture;
}
this is my screenshot, another bufferedimage is for example "compare", where the size of the compared image is smaller than the screenshot. how will I be able to check if the image contain the second image?
*For those who wondering, im trying to make a simple program that clicks a certain image once it pops up.
I have a card game program that when a card gets discarded and is found to be a certain type of card, it goes into my DefeatedChars pile, which is just a PictureBox named DefeatedChars. Currently all my images are loaded during runtime using ImageLocation which is the string of some website that stores all the card images. I want to know how to load this string to the PictureBox's Image property so I can rotate it because trying to rotate gives me a null pointer exception because Image is nothing, at least I think that's why. I do know through debugging that when DefeatedChars.Image is nothing. My question is, is there a way to rotate the ImageLocation after it's been loaded or is there a way to move the image found at the ImageLocation into the image property. Ultimately, when I'm done with the game, I want the image found at the image location to be stored somewhere locally so that if the website changes, which it does, the cards will retain their images and properties, but that's a question for later down the road. Here is the code I am stuck at that gives me a null pointer exception. I'm coding in Visual Studio.
DefeatedChars.ImageLocation = tempCard.ImageLocation
DefeatedChars.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
I tried this...
DefeatedChars.Image = Image.FromFile(tempCard.ImageLocation)
But I ran into a "URI formats are not supported error". Then I found this little gem on the internet, which replaces the first line of code above.
DefeatedChars.Image = Image.FromStream(System.Net.HttpWebRequest.Create(tempCard.ImageLocation).GetResponse().GetResponseStream())
It turns the URL into a stream so it can be used by the Image property and it works like a charm.
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.
So I had a thought -- Say you have pictures streaming to your app from a webpage. Is there any way to put code in the app to find out how many times a person has tapped the image, or how many times they have pressed a button belonging to the image?
Think of the "Like" button for facebook, where people can have +1, and see the total count of how many people also "like" it.
If so, how would one go about coding this?
You question is very vague...
If you want the count of how many time the image was loaded you can count that server side every time the picture is downloaded. If you want to give them a "like" button then you can add that to your WP7 app and call a page server side or a WCF service with some ID value for the picture to track the "likes".
For example:
HTTP Version
You can download the pictures from you webserver using a link such as "http://www.mysite.com/pictures.aspx?ID=Funnyfile.jpg&DeviceID=29393848293".
ID would be the unique ID for your application to know which picture to load
DeviceID would be the Device ID for the WP7 device loading the picture in your app (MSDN doesn't recommend you use the Device ID to identify unique users so you might need to adjust this value).
You could then set the source of an Image Control to that URL to load the image.
Uri uri = new Uri("http://www.mysite.com/pictures.aspx?ID=Funnyfile.jpg&DeviceID=29393848293", UriKind.Absolute);
ImageSource imgSource = new BitmapImage(uri);
ProfileImage.Source = imgSource;
A WCF Service can use a similar manner and would allow you to pull a collection of images back from the server if you need to. The basics of building the service wouldn't be overly complicated, but I am omitting and example to save time.
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.