Image uploader changes image colour - c#

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.

Related

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.

Display thumbnails for images in articles

So I have this website where users can post articles, each article containing at least one photo. What I want to do is when I display the list of articles on the website I want to also show a thumbnail next to the articles name.
Here comes the tricky part: the images are not hosted on my server, are simply links hosted on some image-hosting website. Another problem is that I don't know where the images appear in the post (they could be at the beginning, at the end or in the middle of the article).
What would be the best approach to create a thumbnail system in this case?
I was thinking maybe I could do this: every time an article is posted or edited and stored into the database I could scan the entire articles for images links and store the first link in a separate value in the database (this could be kind of slow though).
Also once I have those values stored and I have to display a thumbnail the only way to do so will be by showing the full image resized to the thumbnail size (that means the user has to download multiple full-size images to see the articles list with thumbnails).
Is there any better approach? (you can see the technologies used in the tags)
Create a thumbnails task that runs in the background after an article has been published.
Find image tags in the article HTML using regular expression.
Get those images and create and thumbnail that you save locally in a folder in your server.
Protect that folder/location against hotlinking.
Use those local pictures as thumbnails
Use HtmlAgilityPack as a starter to get to the images from the image host.
Use an ASP.NET handler to generate the thumbnails. That way, you won't have to store anything locally, the thumbnails images will only exist in memory, making hotlinking impossible

how to upload bmp bitmap image in silverlight?

I am writing a code in silverlight. I want to upload images on my silverlight application. Please help me how do I upload bitmap images and show them on interface. If I am wrong please sort it out.thanks
Silverlight only natively supports .jpg and .png files. You will need a third party library to decode (or convert) bmp files for use by Silverlight.
You could potentially show them in a web browser control within Silverlight, but MS chose PNG and JPG for a reason, so why add complexity.I'd say convert them on the server after upload using one of many third party libraries available.
Can you provide some more detail? Do you want to upload this to a directory on your site, store it within a DB or just retain it for the session and then dispose of the image?
There are a number of examples such as Silverlight File Upload on codeplex. or File Uploader. If you are looking to upload to just a directory on your website you may want to look at this example as well.
Aside from those starting points you need to provide some more detail as where you are having issues.

Converting HTML to image

I have a web app that displays the profile of over 600 people, and each profile displays a word cloud. the word cloud is rendered using html.
The client has requested that the same word cloud to appear in an excel macro that pretty much does the same thing as the web app.
I have seen a few solutions that saves image from rendered page but is there a way to create images from the html programatically, without selecting each of the 600 profiles manually.
Since rendering html is a browser's job, you could take a look at doing it by javascript.
Write a nice little program in jQuery (or your favorite js framework) that renders the word cloud of every profile on a canvas, and then use this:
http://www.nihilogic.dk/labs/canvas2image/
to take an image of the rendered html.
I know it has been a while since I asked this question but I'll answer it for the benefit of others. I ended up using something called IECapt to capture rendering of a web page into a BMP, JPEG or PNG image file;
http://iecapt.sourceforge.net/
I then wrote a unit test to iterate over the various urls, passing it as an argument to the IECapt utility. Was able to render over 600 images in a few seconds.

how to manage image file in c# for asp.net mvc web-application

How to manage user picture in c# for my web application
i want all images as
1.png 2.png 3.png if user upload GIF and jpeg that it is convert to .png
how i can do this.
Phil Haack just wrote about Uploading a file (or files) with ASP.NET MVC.
This will give you a good starting place with your image upload requirements.
Once you've obtained the image from the user you can name it anything you like before saving. You could store all images together and link the user to the image via a database entry or you could create a user image folder and store the image in there.
There's a huge variety of ways you can accomplish your goal so these are just a couple of sugestions to help you along the way.

Categories