Windows Phone 8: Load png from gallery - c#

I want to load png files (with transparency) from the Windows Phone photo gallery. At the moment I am using the PhotoChooserTask. But the problem is, that even if the image is a png, I am getting back image data without transparency. When I look at the png files in the Windows Phone Gallery app then transparency is correct.
Are there means to load png files with transparency from the gallery?
Regards,

Sadly the answer is no. If the image didn't have transparency in it before you cannot add it.
Also (as you have discovered) you only get back an image stream from the media library not the original file itself and the stream only contains the colour data with no transparency.
Best option (if the user uses skydrive) is to use the Live/SkyDrive API to download images from the users backups or from the web.
Alternatively if you are doing a camera app, have a look at the lenses API or the Nokia Imaging SDK

Related

Multiple screen support Windows Phone 8

I used to develop for Android and iOS, and for multiple screen support we use to use mdpi, hdpi, xhdpi.
Now I want to develop for Windows Phone, I want to set a background to a button and I don't know how to define image size to support all screen sizes.
You dont need to provide different assets. See info from MSDN below.
There is a way to support different assets/resources. But we have never done this bevore in our apps.
From MSDN:
Assets such as graphics, video, audio, and icons make up a large
percentage of an app’s size. Including assets for all resolutions in
your app uses a lot of space in your app. For most apps, we recommend
that you include only WXGA assets. WXGA assets have the highest
quality, and they automatically scale to work well for other
resolutions.
More info: Multi-resolution apps for Windows Phone 8
Multiple resolution handling is built-in with WP8.1. You simply need to name your images with the proper qualifier to ensure it is loaded properly by the device.
You can refer to the tutorial here for more info on how to properly name your image resources:
Quickstart: Using file or image resources

Opening WebP image format in Windows Phone 8 application

Is there anyway to open WebP images in windows phone applications? I have a huge set of images to be downloaded from the web and jpg/png are heavy, so looking for an image format that would reduce the data to be downloaded without compromising much on the quality.
First, I recommends you to read https://en.wikipedia.org/wiki/WebP#Criticism. Secondly, since the fact that WebP is a web standard for images, you can try using a WebBrowser as your image control.
Finally, I believe that the reason you cannot reduce the quality its because you want to use the same image as an thumbnail. I suggest you to create a process that will generate a thumbnail, something like 480px x 800px for example. Now your Windows Phone app can show a "preview" of the image, and if the user wants to see the full one, must wait.

Different tile images on different OS versions

Is there any way to specify different tile images for different Windows Phone OS versions.
For example, for WP8 i need to have a non-transparent tile image, and for WP8.1 I need to have a transparent tile image, but this needs to be available without first time opening the app in case the user wants to pin the app to the start screen immediately after install.
I guess the only way to accomplish that is to submit two separate files to the Windows Phone Store.
In the first file you define the non-transparent tile image and target that XAP file only for WP8.0 devices.
Then you would generate a second XAP where you have your transparent tiles. You submit that second XAP to the store and target only WP8.1 devices for that XAP.

How to create a JPEG programmatically

I just try to program a WP8 app in C# which shows pictures on the lockscreen. So far everything works, but how do I create in code a JPEG image, which consists of an Image and a string?
The LockScreen should be then be able to change with
LockScreen.SetImageUri("Picture Uri").
Does anyone have an idea?
You need to save the image to the isolated storage and use the following path: ms-appdata:///local/<your-path-here>.
Links:
Lock screen for Windows Phone 8
Dynamic Lock Screen for Windows Phone 8

Windows Phone 8: how to include image in sample photos?

I am testing a PhotoChooserTask based Windows Phone 8 application in an emulator. I want to test a specific image. Is it possible to somewhere add your own images to the sample photos that the emulator provides?
To be more specific, I want to test a library for decoding JPEG 2000 images, but it is not clear to me how to access arbitrary images on Windows Phone? FileOpenPicker compiles, but it throws a NotSupportedException when the constructor is invoked. The PhotoChooserTask is currently my best bet, but so far I have not been able to figure out to access images that are not part of the sample photos. And as far as I have been able to find out, MSDN documentation also does not provide a good enough answer.
Upload the photo somewhere online, go to that URL in WP8 IE10, tap and hold and click "Save Picture". The picture should now be in your "Saved Pictures" folder which is visible in the PhotoChooserTask.
FileOpenPicker isn't currently supported on WP8. It's only useful for choosing photos from C++ code since PhotoChooserTask is a managed API and is unavailable to C++ apps. Read more about that here # http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj215901(v=vs.105).aspx

Categories