https://github.com/laheller/sharplibraw
C# wrapper around libraw.
https://github.com/laheller/sharplibraw
Last synced: about 1 year ago
JSON representation
C# wrapper around libraw.
- Host: GitHub
- URL: https://github.com/laheller/sharplibraw
- Owner: laheller
- License: gpl-3.0
- Created: 2020-09-26T13:26:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-07T08:43:01.000Z (over 5 years ago)
- Last Synced: 2025-02-25T13:41:19.208Z (over 1 year ago)
- Language: C#
- Size: 371 KB
- Stars: 18
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SharpLibraw
C#.NET wrapper around [Libraw](https://github.com/LibRaw/LibRaw).
Wrapper class *rawlib.cs* includes C# signatures for all external native methods from *libraw.dll*.
Try the demo console application *Program.cs* which demonstrates key libraw features, like:
- initialize library
- open raw file
- export raw file to TIFF
- export thumbnail from raw file to JPEG
- load raw data, process it and export to Windows bitmap
- error handling
# Demo project
To successfully build wrapper and demo application the following steps are needed:
- Download and install Visual Studio 2017 or 2019 Community Edition.
- Open *LibRAWDemo.sln* solution file and start build.
- The built executable *LibRAWDemo.exe* requires to have the included *libraw.dll* library in the same folder (should be there automatically)!
- Note: **64bit build** of the project is **required**, since the included *libraw.dll* is also a 64bit library!
# Sample usage of wrapper
```C#
using System;
using static LibRAWDemo.RAWLib;
class Program {
static void Main(string[] args) {
var handler = libraw_init(LibRaw_init_flags.LIBRAW_OPTIONS_NONE);
libraw_set_output_tif(handler, LibRaw_output_formats.TIFF);
libraw_set_no_auto_bright(handler, 0);
var r = libraw_open_file(handler, @"C:\Temp\RawFile01.cr2");
if (r != LibRaw_errors.LIBRAW_SUCCESS) {
Console.WriteLine("Open file: " + PtrToStringAnsi(libraw_strerror(r)));
libraw_close(handler);
return;
}
r = libraw_unpack(handler);
r = libraw_dcraw_process(handler);
r = libraw_dcraw_ppm_tiff_writer(handler, @"C:\Temp\Processed01.tiff");
libraw_close(handler);
}
}
```