I use a Flex app (SDK version 4.14.1) to take a photo from a camera on Android, and I pass the resulting ByteArray to an .net c# script that writes the image to a directory and sets the name etc.
I can see the file in the file system, I can open the file in the file system (with either a jpg or png extension, I believe that browsers can do this though), but when I add an Image control to Flex and point the source to the path of the image, I just get that annoying missing image icon.
I was guessing that it was to do with extensions, as the image is sent straight from the camera as a byte array I kind of had to guess the extension, but whatever it is can you help me solve it please?
For reference, the image is stored on an IIS web server, but it isn't cross domain policy that is stopping it because if I drag the image into my project and bind it directly it still does the same thing.
Ideally I need to use Image and not BitmapImage, but if it can't be helped then I can change.
Thanks
EDIT
Changing from Image to BitmapImage kind of worked, kind of because the image now shows in the desktop debugger, but on device it just shows blank. Any thoughts on this?
In the spirit of making sure all of my questions get an answer I am going to settle on the solution of using BitmapImage. Every other part of the design is correct, I cannot see anything I am doing wrong, and although using BitmapImage causes me an issue with missing image and placeholder image, it is a solution after all.
Related
When we upload images through our image uploader, it changes the image colours to be very dull. I have been researching this online and came across a couple of articles about the images colour profiles and why the image color changed on stack overflow.
The issue is that we believed the above reason was why it was not uploaded correctly, but when we uploaded the original image other platforms to test, like ebay, google drive and other places with image uploaders, it is uploading as per original.
Is there a setting I need to add to the code which will keep the correct image colour? I have attached a screenshot of the 2 images along side each other, the one on the left is the original, the one on the right is the one uploaded through our image uploader, the uploader is coded into our asp.net webforms project.
Daniel (the Original Poster) contacted me by email as they are making use of jQuery File Upload for the client-side file upload code.
While jQuery File Upload does not manipulate images, it can be used together with JavaScript Load Image or any other client-side or server-side image manipulation library.
I think your assumption is correct that the issue has to do with color profiles. Likely, the image is using an ICC profile (commonly used by PhotoShop), which is currently not supported by JavaScript Load Image.
A related issue is also discussed in this Github issue:
https://github.com/lovell/icc/issues/1
A possible solution would be to disable client-side image resizing, which is controlled in jQuery File Upload with the following option:
https://github.com/blueimp/jQuery-File-Upload/wiki/Options#disableimageresize
If client-side image resizing is already disabled, the issue lies with your server-side image manipulation library.
In that case, either switch to a library with support for the color profile used in your image or disable image manipulation.
I have a C# program that I need to embed an image into or perhaps better stated make the exe file portable such that the image will open on any computer and I need the image to open up in the default picture viewer (not a form PictureBox). I do have the image in the resource folder with 'Embed Resource'
System.Diagnostics.Process.Start = WindowsFormsApplication5.Properties.Resources.MyImage;
I realize the above code is invalid, but I am just a coding hobbyist, so I don't know everything. If I could get a little push in the right direction, I would appreciate it.
This might do the trick for you but If you want a Default Image Viewer to open a picture, you need to store that image to somewhere on your disk, thus the Image Viewer could find and open your picture.
var bitmap = new Bitmap(WindowsFormsApplication5.Properties.Resources.MyImage);
bitmap.Save("YourImageLocation");
Process.Start("YourIamgeLocation");
This is a follow on from my last question (Here) as I don't think I gave enough information the first time around and i can't delete it.
I've got my image converted to a byte array but the follow on help and suggestions made it seem like that the image I wanted to save needed to first exist on my computer. Where, in fact, the image I want to take only exists in the picture box (its a screen grab). When I check my server to see if the image has been passed over, I don't see anything and nothing prompts me to name my image file or anything.
So my question is thus:
What is the best way for my to upload a screen grab from my application, using webclient, to my central server? Ideally the functionality I would like would be very similar to that of saving the image to my computer. The only difference is, it's not my hard drive I'm saving the image on. It's a server somewhere.
I'm developing a Windows 8 Store App, I have this problem,
I want the user to add the videos from a file picker and i managed it,
the problem is I want to display the videos images in a GridView,
like snap shot of the video in a certain position, i tried the media element and it's not working
also an image and it doesn't make sense.
There might not be a pure C# solution to this problem. Perhaps SharpDX would let you do that, but I haven't tried and I don't know if it was done before. If you look at these two threads:
http://social.msdn.microsoft.com/Forums/fil-PH/wingameswithdirectx/thread/05731d4f-5b7f-4ed1-8e28-94604655139e
http://social.msdn.microsoft.com/Forums/en/wingameswithdirectx/thread/ffacd05c-6e9e-43bf-b691-99127240730c
-- you should see that there is a TransferVideoFrame method you can use to copy a frame from a video stream to a DirectX texture. The Media engine native C++ video playback sample shows how you can use it natively. If you search for TransferVideoFrame+SharpDX - you can find this sample that uses the SharpDX version of this method in C#. After you transfer that frame to a texture - you can either copy the contents of the texture to a WriteableBitmap using the Map and Unmap methods like here. You can also save it to a file either using BitmapEncoder a here or directly from the DirectX texture to a file using WIC or say SharpDX Toolkit as in here. You will probably want to build a cache of thumbnails to avoid having to process the videos every time you display the list, so saving to a file is something you should do anyway.
Your own solution that you quoted elsewhere that should work for at least some videos:
var thumb = await
storageFile.GetThumbnailAsync(
Windows.Storage.FileProperties.ThumbnailMode.PicturesView,
1000,
Windows.Storage.FileProperties.ThumbnailOptions.UseCurrentScale);
I suggest using GetThumbnailAsync(), which works just as well. You don't even need to get the video properties or anything like that. If the StorageFile is loaded, this should work for a normal video of any format.
I am writing a C# desktop application that involves importing images from a digital camera, and saving them in a SQL Compact Edition database. I'm not saving the actual images in the database, but the image file path (to save database space). I'm then pulling that image file path from the database and setting the Image Location property of a Picture Box to that path, for display purposes.
My question is this... I would like to add a button that will allow the user to rotate the image after import. Is there a way to do this without creating a new image? I know of the RotateFlip method, but it only works with type Image. Basically, I want to rotate the image linked the file path instead of creating an image from that path, then rotating it. I would love some ideas. Thanks!
You can't rotate an image given it's path unless you load the image first.
By the way, there was no need to include information regarding the database you are using, that information has nothing to do with your problem.