View Single Post
  #1  
Old 07-19-2007, 11:09 PM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 632
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-03-2007 at 11:04 PM.
Reply With Quote