how to upload bmp bitmap image in silverlight? - c#

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.

Related

Create PDFs with Images in wp8

I am making an app in which I want to create pdfs out of the images I store in the Isolated storage. Many opensource libraries are available for solving the purpose but unfortunately none expresses their comparability with windows phone 8.
then I came across this link
the post explains about writing the pdf file by making the pdf header. But, this only creates a pdf with some text written in it. I, now want to add some images in it. How shall I proceed for the same?
I have found the answer myself. These are the links which would be very much helpful if you are looking to make a pff
with text and images without the usage of opensource libraries.
http://www.codeproject.com/Articles/18623/Add-Images-and-Textboxes-to-PDF
http://www.codeproject.com/Articles/7627/PDF-Library-for-creating-PDF-with-tables-and-text
http://en.wikipedia.org/wiki/Portable_Document_Format#Imaging%5Fmodel
Understanding the PDF file format – how are images stored
http://blog.idrsolutions.com/2010/04/understanding-the-pdf-file-format-how-are-images-stored/
Check the above links. They might be helpful.

C#/ASP.NET - Get thumbnail from PDF/DOC files

I have an ASP.NET WebForms application (written in C#) that allows users to upload files using the FileUpload control.
What'd be great is if I could automatically generate thumbnails from files. Images such as JPG/PNG are trivial of course, but users will often upload .DOC and .PDF files - is there a way I can essentially convert .DOC and .PDF files to images so I can get a thumbnail?
Thanks!
You can use GhostScriptWrapper for generating image thumbnails directly from pdf.You can get ghostScriptWrapper from GitHub or you can include ghostscript.dll from nuget package manager solution.
On paper the most hopeful approach would be to do so server side. So, if the file were uploaded, the server could generate a preview image.
On Windows, there would be a few options.
a) Windows Shell has a way to do it. The path is dangerous though.
b) https://filepreviews.io/ Is a service that does it, but they charge.
c) box is another service that does it.
Now on Linux, or even, perhaps, a Linux in a Windows subsystem, could do it with some command line utilities.
a) Convert the doc to pdf:
Convert DOC to PDF
b) Then, get a bitmap of the first page of the pdf, use ghostscript. ghostscript also exists for .NET and Windows.
Bitmap of PDF First Page
For PDf you can try ABCPDF from websupergoo. With that you should be able to generate a thumbnail,
Documentation link for creating a PNG from a PDF. http://www.websupergoo.com/helppdf8net/source/4-examples/19-rendering.htm
also for Doc, it is a little more complex, you are going to have to install the office application on the server that host the apps and from there manipulate the image.
Look at this article. It lets you extract the thumbnail image that Windows Explorer uses for Office documents and regular images.
http://msdn.microsoft.com/en-us/library/aa289172.aspx

.NET graphic libraries to display images (pdf, .docx and any other format of image) in the browser

I am developing a ASP .NET MVC application where users are able to upload files to a repository. Those files could be pdf, doc, any type of image and so on.
When the user select a file to be imported I would like to display this file in the browser so they can review its contents before the upload.
I know I could use some sort of IFrame to display pdf but I am looking for some specific class or .net libraries to implement this feature.
I just need a north.
This is an extremely difficult problem. There are some libraries that can help. For instance PDF files might be rendered to images with ghostscript. Word and Excel files might be converted to PDF or image with a number of libraries. None of them, AFAIK, are very good at it so I can not recommend one.
You could automate MSO to perform the conversion to PDF, but that is decidedly not safe for server code. Another possibility is convert source documents to SWF files (like flexpaper) and display in flash. There are some great libraries out there, but it will limit your supported clients. Sharepoint has support for providing some of this capability as well. Others have used OpenOffice to convert MSO documents but also at a loss of quality.
I can't really advise any specific direction as it is highly dependent on what you/your company is willing to spend and the desired results. Good luck.
You could try to rely on Windows and the explorer thumbnails for it, like here, but then you'd have to make sure that:
You can abuse the server in the most elaborate way (install stuff, talk to the shell from ASP.NET)
You have a thumbnail provider installed on the server for every type that you want to preview. I guess from the moment you can see the thumbnail in explorer, you're set. So for pdf, you might need to install PDF Reader from Adobe.
Docx files should be saved with thumbnail checked (see link). There seems to be no other easy, free way to convert a docx to a thumbnail. The "best" solution I came across, was saving it automatically again somehow, and making sure the thumbnail option is checked.
I don't want to say that's impossible, but it can't be done with finite effort.
What you are asking for is a browser-based solution, because you want the user to be able to "review" the document before uploading.
Therefore you cannot use a server side solution, which is essentially what is being asked by referring to a ".Net library".
.Net libraries are dependent on an installed version of .Net, which does not exist in all versions for all operating systems for which graphical browsers exist.
Next, recent changes in browser security do not allow to read the full client-side file name of the selected file in the input field.
You'd have to rely on HTML5 and its FileReader to access the file's byte stream, but even then you can only retrieve image from image files. (see sample)
Excluding browser-based solutions in Flash, ActiveX, Java, due to browser and platform support, this leaves JavaScript as the only "reasonable" solution: you'd need a library for each supported format to either convert a file into an image in an image format supported by browsers, or extract the text(+image) representation of a file.
Great awnsers... Just want to share the result of my research and I found a nice client-based solution supported by Mozilla Labs. This is a framework based on HTML5 and Javascript with no native code needed.
Here the project website:
https://github.com/mozilla/pdf.js
This is what you are capable of:
http://mozilla.github.com/pdf.js/web/viewer.html
And for the last a great video explaning how everthing works
http://www.youtube.com/watch?v=Iv15UY-4Fg8&noredirect=1
Reguarding my question we are going to converter every possible file to PDF on the server and then render this PDF using this framework.

Display a .raw image in ASP.NET 2010 WebForms

I am working on a web application, and i have to show an image in a popup page but the image extension is ".raw", i try to set the imageurl to an image control of asp.net or to a img tab of HTML but it doesn't works. It's a 32 bit image and the size is 1920 x 1080, and the platform that i am using is asp.net 2010 webforms with C#.
How can i render a .raw image to be displayed on a asp.net web application?
Since .raw files are not supported by browsers (unless some addon/plugin/extension can handle it) the browser does not know what to do with it.
What you can do is create an IHttpHandler that will handle this extension (you map it in web.config). In the code behind, the handler will find the .raw file, encode it in some other popular format like .jpeg (and probably persist it to disk so as to not re-encode everytime you want to access the .jpeg equivalent) and output that to the browser.
Since .raw is a generic format that just means that the file is in the format as created by the imaging device, finding the proper tool for the conversion may or may not be easy. I would start by trying ImageMagick and dcraw.
Check http://en.wikipedia.org/wiki/Raw_image_format for more reading.

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