简体   繁体   中英

How to use ARW file and sony's codec in c#

I tried different examples and did google also but could not find any working c# solution.. also found some codes in different languages but I'm unable to convert them to c# please help...

I've tried this:- Convert .arw Sony photo to .raw file

Also found dcraw source code but could not find anything related to ARW...

Image.FromFile and Image.FromStream methods was also giving "Parameter is not valid."

Just now I tried this and got "The image cannot be decoded. The image header might be corrupted."

BitmapDecoder bmpDec = BitmapDecoder.Create(new Uri(file), BitmapCreateOptions.DelayCreation, BitmapCacheOption.None);
BitmapEncoder bmpEnc = new BmpBitmapEncoder();
bmpEnc.Frames.Add(bmpDec.Frames[0]);
Stream ms = new MemoryStream();
bmpEnc.Save(ms);
Image srcImage = Bitmap.FromStream(ms);

Please help me to convert arw raw files to jpegs. I wanna do it with or without codecs. I don't know how to use sony's code so please help me with that. I just want to make this program work

I've found how to do it. Simply install the Sony Codec downloadable here https://esupport.sony.com/swu/4025/US/

And then the BitmapDecoder will work properly.

"The image cannot be decoded. The image header might be corrupted."

I got the same thing if the C# applications platform was "Any CPU" or "x86". Setting the platform to "x64" fixed it for me. I also got the same behaviour when using the the codec from native C++ and WIC over COM. Ie it wouldn't work if called from a 32bit application but it did for a 64bit application.

Sorry for posting on an old thread but there isn't much information available about this topic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM