Guide for C#
Download Image from URL
Core Document Formats
Additional Features

C# Imaging - Download Image from URL in C#

Free Visual C# Sample Codes to Download Image from URL with .NET Image SDK

Visual C#
Home > .NET Imaging SDK > C# > Download Image from URL
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

RasterEdge .NET Image SDK includes several library controls for developer to perform complete image processing tasks, especially for downloading an image from url. The RasterEdge.Imaging.Basic.dll is simply one of them. This component also offers others ways for users to load an image for manipulation and processing. Supported methods include loading an image from local file, loading an image from .NET Graphics, and create a brand-new image with C# coding. And below is detail features of downloading an image from url in C#.NET program.
Related .net document control helps:
asp.net sharepoint document viewer control: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net office viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net view excel in browser: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net view powerpoint: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net view text file in browser: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net pdf editor component: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
  • Easily download an image from a web page with user-defined URL
  • Download images from web URL in png, jpeg / jpg, gif, and bmp image formats
  • Visual C# sample codes to fetch an image from a web URL and save to load disk
  • Detailed tutorial to download image from ULR and save it in C#
  • Independent control without using any third party tools or plugins
  • Compatible with Microsoft Visual Studio 2005 and above
This page will discuss how to download an image from URL in the following sections:
  • How to create a C# imaging application
  • C# methods for imaging URL downloading
  • C# demo codes to download an image from web URL
  • More tutorials for C# imaging loading
This tutorial will put emphasis on how to download an image from a user-defined URL, and save it to your local file. Almost all the major image formats are supported, including jpeg / jpg, gif, png, and bmp. This tutorial is aimed for Visual C# developers. In case you are using Visual Basic, please navigate to this VB.NET Guide for Downloading Image from a URL. Detailed imaging steps are demonstrated as well as the Visual Basic .NET 2005 sample codes.
How to Create a C# Imaging Project
This guide informs users of how to download image from URL with RasterEdge .NET Imaging SDK using Visual C# sample codes. Since this library is compatible with .NET development environment such as Microsoft Visual Studio, now we are taking Microsoft Visual Studio 2005 as an example for creating an imaging project to get ready for the image downloading.
  1. Open your MS Visual Studio and create a Windows application in C# programming language;
  2. Add this imaging library to your C#.NET project reference: RasterEdge.Imaging.Basic.dll;
  3. Now activate your trial / purchased license for this SDK, and copy the generated txt file along with the DLL above to your imaging project bin folder;
  4. You can now call RasterEdge .NET Image SDK Namespace:
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Codec;
Method to Download Image from URL in C#
RasterEdge .NET Imaging SDK provides the following C# method for downloading an image from a user-specified web URL. Replace the string with your target URL, and then select BaseDecoder according to its image format, such as PNGDecoder, GIFDecoder, JPGDecoder, BMPDecoder, etc.
Please note that the image format should be in accordance with the format from your URL. If you want other format, you can use the image converter to freely convert between different image formats or into other formats after it has been downloaded. Here is an example on how to convert image to byte, and how to convert an image to stream.
public static REImage GetImageFromURL(string url, BaseDecoder dec);
C# Demo Code for Downloading Image from URL
Now that you have successfully created your .NET imaging project, called the namespace and learned the downloading C# method, here is the complete Visual C# code example demonstrating how to download a png image from a ULR that you have given. The demo shows a png example, but you can also save a gif, jpeg / jpg, or bmp image from a URL to your local file using Visual C# programming language.
After the image is downloaded and saved, we provide other tutorials for developers to process the image further. You can create watermark on the image, crop the image, adjust the image color in C#, and annotate the image with various shapes. You can learn more about the image processing features on the left side navigation.
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.Basic;

namespace RE__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
REImage reImage = REFile.GetImageFromURL("http://www.rasteredge.com/Sample.png", new PNGDecoder());

REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
}
}
}

More Image Viewing Tutorials



Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com