IT Community - Software Programming, Web Development and Technical Support

Converting image from one format to another in C#

This is a discussion on Converting image from one format to another in C# within the C# Programming forums, part of the Software Development category; Hi Guys, Converting image from one format to another through C#.Lets discuss about this in this thread.Cheers...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-11-2008, 05:44 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Converting image from one format to another in C#

Hi Guys,
Converting image from one format to another through C#.Lets discuss about this in this thread.Cheers
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-11-2008, 06:34 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Default Re: Converting image from one format to another in C#

Hi,
Yes.We could do that by using the following code
Code:
   Image imgInFile=Image.FromFile(strFileName);
    imgInFile.Save(strOutFileName,ImageFormat.Bmp);
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-12-2008, 12:25 PM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi Sathish,
I need to convert a pdf to a bmp image.Any help thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-12-2008, 12:32 PM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
Actually ,PDF's are not an image format. They are a set of instructions used by Adobe Acrobat to render a document.
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-12-2008, 12:34 PM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi Sathish,
Yes.I know that its not an image format.But can u help me to convert pdf to tiff or bmp image.Thanks in advance.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-12-2008, 12:39 PM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deepan,
Yes.Here is the code to convert pdf to an image.
Code:
using ( FileStream file = new FileStream( "test.pdf", FileMode.Open, 
                                                      FileAccess.Read ) )
{
   // open the PDF document

   Document document = new Document( new BinaryReader( file ) ); 
  
   // get the first page

   Page page = document.Pages[0];   

   // you must apply a scale to the PDF graphics proportional to the 

   // resolution

   float dpi = 300;
   float scale =  dpi / 72f;
   
   using ( Bitmap bitmap = new Bitmap( (int) ( scale * page.Width ), 
                                       (int) ( scale * page.Height ) ) )
   {
      // wrap a graphics around the bitmap

      Graphics graphics = Graphics.FromImage( bitmap );
  
      // apply the scale that accounts for the resolution

      graphics.ScaleTransform( scale, scale );
      
      // do the actual rendering

      page.Draw( graphics ); 
  
      // save the result as a bmp - could be any format

      bitmap.Save( "test.bmp", ImageFormat.Bmp );
   }
}
Let me know if u have any questions.
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-12-2008, 12:41 PM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Wink Re: Converting image from one format to another in C#

Hi Sathish,
Thanks Sathish.Let me check this code and let u know
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-12-2008, 12:42 PM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Sathish,
Its working fine.Thanks for ur help.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-12-2008, 12:44 PM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
Good to see that u got ur issue solved
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-19-2008, 08:39 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi ,
Does anybody know about RAW image formats?Any help thanks.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 02-19-2008, 08:41 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
RAW image formats are the image formats that are not universally accepted image file formats but that are being used by many camera manufacturers.For example, cr2 image file format.
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-19-2008, 08:42 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi Sathish,
So does all the camera manufacturers use the cr2 image file format only?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-19-2008, 08:48 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi,
Is there only only unique RAW file format or there are many.If there are so many,can u tell them what are they?

Last edited by a.deeban : 02-19-2008 at 08:52 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-19-2008, 09:02 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
Yes.Different camera manufacturers use different RAW image file formats.For example,
  • CR2 - Canon
  • NEF - Nikon
  • PEX - Pentax
  • SR2 - Sony
  • ORf - Olympus

These are few of the known RAW file formats and camera manufacturers.
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 02-19-2008, 09:09 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi Sathish,
Its good to know abt the RAW files.So these are the files that are produced by different cameras.Great !! How can I have some RAW image files?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 02-28-2008, 02:15 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
There are so many RAW files thats available in the Internet.You can have them from the following sites:
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 02-28-2008, 02:17 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi ,
Does anybody know how to convert these files to jpeg or png files?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 02-28-2008, 02:22 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
There are so many conversion tools available to convert the RAW files to jpeg or png files.U can use them in your application and can convert RAW files.
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 03-10-2008, 12:14 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Exclamation Re: Converting image from one format to another in C#

Hi,
Can anybody give me the details about the Image conversion tool in .net so that I can check whether that is useful for me?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 03-10-2008, 12:24 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Converting image from one format to another in C#

Hi Deeban,
Though there are many,I can suggest you a simple Image Conversion tool in which we use .Net 2.0 framework .You can get @
Image Conversion Utility in C#
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/c-programming/5233-converting-image-one-format-another-c.html
Posted By For Type Date
DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 02-12-2008 09:41 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert image to other image format using CODEC in .NET 3.0 Mramesh C# Programming 0 02-07-2008 02:33 AM
Converting a generics List<T> to string[] oxygen C# Programming 4 12-21-2007 02:34 AM
How to convert jpg, bmp, tif,... image formats in to another format using c# .Net? Archer C# Programming 1 09-07-2007 07:23 AM
Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET oxygen C# Programming 5 08-16-2007 02:26 AM
Better Image Format Joe Web Design Help 12 03-06-2007 10:31 PM


All times are GMT -7. The time now is 05:39 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0