Rotating Image in C# Desktop Application from Image Location Only - c#

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.

Related

Image uploader changes image colour

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.

Open a bitmap using default photo viewer without saving file

I have a WinForms app that takes a screenshot, and I want to be able to view this screenshot. Originally I was creating a new instance of a PreviewForm which contained nothing but a picturebox, but if the image being previewed was large, the screenshot is kind of useless.
I'm aware of defining a filepath and using Process.Start(), but this would require this screenshot being saved locally before opening.
Is there no equivalent method to open an image in image viewer from just a bitmap object?
I find it would be easier if you just saved it and opened it with a software. I tried to find many different ways to not save the file, but there aren't any unfortunately, so I have to save it and open with a tool like this: http://www.paintshoppro.com/en/pages/bmp-file/

Process Start to open image file in resources folder

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");

Android Mobile: Flex Image control showing missing image

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.

Webclient image upload to server

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.

Categories