IT Community - Software Programming, Web Development and Technical Support

Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

This is a discussion on Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET within the C# Programming forums, part of the Software Development category; Convert NEF into jpeg or tiff Goals: This porject is used to convert NEF files into Jpeg or Tiff. Steps: ...


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 07-20-2007, 12:09 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

Convert NEF into jpeg or tiff


Goals:

This porject is used to convert NEF files into Jpeg or Tiff.

Steps:

1) Create a C# windows application project.

2) create a button control.

3) add the library reference of Adobe Photshop Type Library 8.0

4) Add the namespace

using ps = Photoshop;
using PhotoshopTypeLibrary;
using K = PhotoshopTypeLibrary.PSConstants;

5) copy the following code.



ps.ActionDescriptorClass ad = new Photoshop.ActionDescriptorClass();
ps.ApplicationClass app = new ps.ApplicationClass(); // specify the filename
ad.PutPath((int)K.phEnumNull, "D:\\WorkArea\\FLASH\\UploadedFiles\\Monalisa.NEF" );
ps.ActionDescriptorClass ad2 = new Photoshop.ActionDescriptorClass();
ad2.PutString(app.CharIDToTypeID("CMod"), "Nikon D70"); // camera model
ad2.PutEnumerated((int)K.phTypeColorSpace, (int)K.phTypeColorSpace, (int)K.phEnumAdobeRGB1998); // color space
ad2.PutEnumerated((int)K.phTypeBitDepth, (int)K.phTypeBitDepth, (int)K.phEnumBitDepth16); // bit depth
ad2.PutInteger((int)K.phKeySizeKey, 3008); // the width... why?
ad2.PutDouble((int)K.phKeyResolution, 240.0); // DPI
int ReUnID = app.CharIDToTypeID("ReUn"); // ???
ad2.PutEnumerated(ReUnID, ReUnID, app.CharIDToTypeID("PpIn")); // maybe this forces it
ad.PutObject((int)K.phKeyAs, app.StringIDToTypeID("Adobe Camera Raw"), ad2); // identifies the target object
app.ExecuteAction((int)K.phEventOpen, ad, (int)ps.PsDialogModes.psDisplayNoDialogs);
app.Quit();

6) run the application.

Last edited by oxygen : 08-04-2007 at 12:04 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-04-2007, 12:21 AM
muthuramkumar muthuramkumar is offline
D-Web Trainee
 
Join Date: Mar 2007
Posts: 10
muthuramkumar is on a distinguished road
Default Re: Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

Hi Oxygen,

I am also working on the raw images conversion processing. Really its good for me. But in my project i have support all kinds of RAW images. do you have conversion for any other RAW image types? particularly i need for CRW,RAF type RAW images. It will be good if u give some idea on this.


Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-04-2007, 12:55 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default Re: Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

Hi Oxygen,

Is there any simple way to convert the NEF image into JPEG or TIFF using Photoshop DLL.

Thanks...

S.Balasubramanian..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-06-2007, 03:07 PM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Smile Re: Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

Hi bala,

You can use the below snippets for conversion.

Photoshop.ApplicationClass app = new Photoshop.ApplicationClass();
app.Visible = false; app.DisplayDialogs = Photoshop.PsDialogModes.psDisplayNoDialogs;
Photoshop.JPEGSaveOptionsClass jpgs = new Photoshop.JPEGSaveOptionsClass();
Photoshop.TiffSaveOptionsClass tiffs = new Photoshop.TiffSaveOptionsClass();
jpgs.Quality = 8;
Photoshop.Document ps = app.Open(@"D:\pt.NEF", null); ps.SaveAs("D:\\psaveimage", jpgs, null,2);
ps.SaveAs("D:\\saveImage1", tiffs, null, 2);
ps.Close(null);
ps = null;
app.Quit();
app = null;

hope its useful
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-07-2007, 01:21 AM
muthuramkumar muthuramkumar is offline
D-Web Trainee
 
Join Date: Mar 2007
Posts: 10
muthuramkumar is on a distinguished road
Default Re: Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

Oxs

I tried ur new code to convert the CRW files,but it say 'Out of Memory' issue. I have to implement these option in my prjoct very shortly. Please help me to come out from this issue.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-16-2007, 03:26 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: Converting Nikon camera RAW images to JPEG,TIFF files using Adobe dll in C#.NET

Hi,

I have tried to convert raw images using DCRAW. Dcraw is a raw converter used to convert more than 244 different types of raw images into tiff or jpg or ppm. Dcraw source can be download from the site Decoding raw digital photos in Linux as C or C++ source. Dcraw converts the raw image with Exif properties. Supported raw formats: CRW, CR2, MRW, NEF, RAF, etc..
Dcraw exe can be download from http://www.insflug.org/raw/.

C# code to call dcraw exe:

Process proc = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo("dcraw.exe", "-T D:\\sample.CR2");
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.UseShellExecute = false;
proc.StartInfo = startInfo;
proc.Start();
while (!proc.HasExited)
{
}
proc.Close();
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
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/2272-converting-nikon-camera-raw-images-jpeg-tiff-files-using-adobe-dll-c-net.html
Posted By For Type Date
Converting Nikon camera RAW images to JPEG,TIFF files using Adobe ... | Web Hosting This thread Refback 10-30-2007 08:10 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract IPTC Metadata from jpeg and tiff image formats Balasubramanian.S C# Programming 26 11-13-2008 01:19 PM
Converting image from one format to another in C# Sathish Kumar C# Programming 24 06-04-2008 02:06 AM
Applying ICC profiles to a TIFF,JPEG files using C# oxygen C# Programming 1 02-28-2008 11:42 PM
Reading IPTC data from Nikon camera RAW images,JPEG,TIFF files using Adobe dll in C# oxygen C# Programming 1 02-28-2008 11:33 PM
Reading and writing EXIF meta data from jpg/jpeg,tiff images oxygen C# Programming 0 07-15-2007 11:24 PM


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


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

SEO by vBSEO 3.0.0