Jump to content
How to Install Plugins ×

RAWLOAD v1.0 Load Raw files with metadata using WIC


avatare

Recommended Posts

2/7/2010 Made changes to the code to supprot better error handling and changed the amount of supported formats. Going to post in the publishing section

This is the first plugin that i launch to the public in general hope that it helps sony users that use paint.net to do postprocessing. Please let me know of any issues that you find

Plugin description

I loads raw files for paint.net using the windows imaging component and its been made so that the metadata from images get copied.

Compatability

Supported files are the following

".arw", ".srf" , ".sr2" , ".new" , ".nrw" , ".cr2" , ".crw", ".orf"

Installation Instructions

1-Download http://www.fastpictureviewer.com/codecs/support/?ver=1.64 please use this one with the application(this is not freeware is donationware if you decide to use it for the run you got to donate some bucks to them).

2-Install this plugin on paint.net

Tested With

Sony alpha 100

Future versions

Need Nikon, cannon raw files in order to do more testing.

Need to figure out what to do with error msgs

Need to write code to figure out if the correct codec pack is installed otherwise for the plugin to warn user since i cannot guarantee fucntionality.

ARWLOAD.zip

Link to comment
Share on other sites

  • 2 weeks later...

I found the issue why some images were getting degenarated when imported and it was simple the sony provided codec is really awful in terms of providing a quality raw out of it. i found a third party provider that supplies codecs and makes it for almost all cameras and works just fine. :) . So people please try it with the new instructions and let me know your thoughts and will edit the plugin during the next month to make sure it supports Nikon and cannon also.

Please test it.

Link to comment
Share on other sites

  • 4 weeks later...

Has anyone had sucess using the plugin would like some feedback since i think i'm going to expand it to use all of the raw files provided by that codec provider and i have added some error logic since it would actually bug out in certain configs.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Just tried it with NEF, NRW, CR2 and works great. Just a couple of suggestions: enumerate all installed codecs, gather the supported file extensions from each codec and build your filter dynamically, so when a new codec gets written your plugin just sees it automagically (and you also support all existing codecs right away). I did this with my Photoshop WIC Import Plugin (which does the same thing as yours, but for Photoshop). You can filter out on the Vendor GUID if you want to exclude stock codecs from your scan: Microsoft's VendorGUID is {F0E749CA-EDEF-4589-A73A-EE0E626A2A2B}, but then you might inadvertently exclude the PSD codec that ships with Blend 3...

Besides that the codec pack's URL is http://www.fastpictureviewer.com/codecs/

You can find sample raw files at rawsamples.ch, raw.fotosite.pl and imaging-resource.com

Thank you for emphasizing the donationware status of the codecs. Cannot wait to see them in action with Paint.NET, thanks to your plugin!

Axel (codec's author)

Link to comment
Share on other sites

Hi,

This WIC plugin seems like a very good idea that should have been done a long time ago. It also seems reasonable to base it on Axel's donation-ware FastPictureViewer Codec's, which automatically install on both 32 and 64 bit Windows OS's and are frequently updated as to supporting new camera models. Axel's suggestion below seems to be a good one in principle, as follows:

Just a couple of suggestions: enumerate all installed codecs, gather the supported file extensions from each codec and build your filter dynamically, so when a new codec gets written your plugin just sees it automagically (and you also support all existing codecs right away). I did this with my Photoshop WIC Import Plugin (which does the same thing as yours, but for Photoshop). You can filter out on the Vendor GUID if you want to exclude stock codecs from your scan: Microsoft's VendorGUID is {F0E749CA-EDEF-4589-A73A-EE0E626A2A2B}, but then you might inadvertently exclude the PSD codec that ships with Blend 3...

However, I have a few further suggestions, as follows:

1) Rather than enumerating all installed codec's and excluding those written by Microsoft, I suggest that you only support those codec's with the FastPictureViewer VendorGUID, which is {A6D092A4-081A-4F0E-9356-DA167E87D922} and make the presence of the codec's a condition for supporting each type of file (and file extension). In this way, your plugin would only handle file types for which the codec is installed.

2) Further, when the plugin is called to do a conversion, force the selection of the decoder based on the Container GUID as supported by each of the FastPictureViewer codecs and the preferred VendorID as above so that you know you will be getting a consistent raw conversion by a known codec even if other codec's such as the camera manufacturer ones are installed as well.

3) Finally, you may find it much easier to do the above if you write the plugin in managed C++ in order to be able to call the WIC interfaces by just including the WIC header files in your main C++ code; all or most other marshaling of data between the managed plugin and the unmanaged WIC codec system would then be done by managed C++'s IJW (It Just Works) system so the code to do such a thing is not much more than you have now. You can do the same thing using C#, but you will have to declare all the WIC interfaces in C# as ComImport compatible interfaces, which can be very time consuming. For instance, to declare the IStream interface which is based on ISequentialStream, and which is required to be passed to many process the data in the stream, you would need to declare the following:

(EDIT: Shown further down the thread in a later post)

You will need to declare an object that wraps the DotNet native Stream class in a COM compatible IStream interface in order to be able to pass the stream through to WIC.

These are just two of at least a dozen interfaces you will need to declare out of the full set of WIC interfaces in order to accomplish the proposed changes.

There are other similar complexities such as in declaring a C# object to represent the PROPVARIANT structure, which is required to receive what is returned by the IWICMetadataQueryReader.GetMetadataByName method you use when you read metadata using WIC directly instead of the BitmapMetadata class's GetQuery method you use now. All of the available classes you currently use do all of this marshaling, interfacing, and conversion for you behind the scenes, but they aren't capable of selecting specific WIC decoders out of the set of available ones.

In short, if you want to implement the suggestions, using managed C++ for your plugin would be much easier. However, if you want to do it with C#, it is possible and I may be able to help.

Regards, Gordon

Link to comment
Share on other sites

  • 2 weeks later...

@Everyone: Sorry for not replying in a long time but i have been buried in work for the past couple of days.

@ Axel Rietschin : i think your codecs are fantastic thanks for taking a look at my plugin for paint.net and for the sugestion regarding the listing of the files.

@Gordon: I like the second idea of always using the same codec if there is more than one installed but i don't want to limit to the one's in this codec pack. I was trying to do the entirec plunging using system.windows.imaging but it seems like i will need to use the wrappers for it.

@ks8802: will add it for the next version.

@Everyone: does the metadata transfer work fine for everyone ??? I think that i will pass this plugin to the publishing area so other people can start using it also.

@Moderator:Could you actually move this thread to publishing so that i don't have to copy all the info :D

Link to comment
Share on other sites

@Gordon: I like the second idea of always using the same codec if there is more than one installed but i don't want to limit to the one's in this codec pack. I was trying to do the entirec plunging using system.windows.imaging but it seems like i will need to use the wrappers for it.

I don't think you are going to manage to write a complete solution using just the System.Windows.Imaging.Media namespace as I think you then are completely dependent on the Windows Imaging Codec (WIC) system arbitrating which codec decoder gets used for each image file extension you list that you can support, which would be completely subject to the number of codecs installed for each and the manufacturer supplied ones would likely be given the priority. Accordingly, I think you are going to have to use the wrappers, and just in case you aren't familiar with producing those I included a couple of examples in my last post, but forgot to use the Code markers for proper indentation, etc. As follows:

The ISequentialStream interface wrapper:

using System;
using System.Runtime.InteropServices;

namespace WIC {
[ComImport, Guid("0c733a30-2a1c-11ce-ade5-00aa0044773d"),
	InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISequentialStream {
	[PreserveSig]
	int Read(
			[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv,
			[in] uint cb,
			[Out] out uint cbRead);
	[PreserveSig]
	int Write(
			[in, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv,
			[in] uint cb,
			[Out] out uint cbWritten);
}
}

and the IStream interface wrapper, which adds to it:

using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;

namespace WIC {
[ComImport, Guid("0000000C-0000-0000-C000-000000000046"),
	InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IStream : ISequentialStream {
	[PreserveSig]
	new int Read(
			[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv,
			[in] uint cb,
			[Out] out uint cbRead);
	[PreserveSig]
	new int Write(
			[in, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv,
			[in] uint cb,
			[Out] out uint cbWritten);
	[PreserveSig]
	int Seek(
			[in] long dlibMove,
			[in] uint dwOrigin,
			[Out] out ulong libNewPosition);
	[PreserveSig]
	int SetSize(
			[in] ulong libNewSize);
	[PreserveSig]
	int CopyTo(
			[in, MarshalAs(UnmanagedType.Interface)] IStream stm,
			[in] ulong cb,
			[Out] out ulong cbRead,
			[Out] out ulong cbWritten);
	[PreserveSig]
	int Commit(
			[in] uint grfCommitFlags);
	[PreserveSig]
	int Revert();
	[PreserveSig]
	int LockRegion(
			[in] ulong libOffset,
			[in] ulong cb,
			[in] uint dwLockType);
	[PreserveSig]
	int UnlockRegion(
			[in] ulong libOffset,
			[in] ulong cb,
			[in] uint dwLockType);
	[PreserveSig]
	int Stat(
			[Out] out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg,
			[in] uint grfStatFlag);
	[PreserveSig]
	int Clone(
			[Out, MarshalAs(UnmanagedType.Interface)] out IStream stm);
}
}

In case you've never produced these before, you need to declare the methods in the exact order that they are declared in the C++ header files and an interface that builds on another interface needs to redeclare all the same methods as the previous interface(s) first with the new keyword as IStream above is based on ISequentialStream. The above two interfaces allow you to create a wrapper class for the Stream object that is passed to your OnLoad method for your FileType class so that you can pass the IStream interface pointer as an argument to the decoders and not have to do this by getting a file name. As Rick says, at some point you might be passed a MemoryStream rather than a FileStream and the FileName would not apply.

As to wanting your plugin to work with any installed codec, that is entirely a matter of your program logic as to what you do once you have enumerated all installed codecs: You can put first priority on the FPV ones if they are found and revert to just providing a generic handling and let WIC arbitrate for any others for that file type if they exist and the FPV one does not. Also, I think you should create different FileType classes for each file extension handled and either link them to to the specific FPV codec or to the generic case; in this way you can automatically support all image file classes by getting the file extensions supported from the decoder enumeration, which would avoid requests such as ks8802's for support for the Panasonic '.rw2' file type as below.

@ks8802: will add it for the next version.
@Everyone: does the metadata transfer work fine for everyone ??? I think that i will pass this plugin to the publishing area so other people can start using it also.

I think your method should always work as you seem to use the same method as used by Rick Brewster in his WIC codec support for the HD file format (now WDF or other). I'm sure you must be used to using Reflector to see what others are doing in their code, just as I can see what you are doing with yours?

There are actually even further capabilities you could add, as the FPV decoders support the IWICDevelopRaw interface (or at least some of them do) and allow you to do exposure adjustments to the raw development before it would be passed to Paint.NET. This would require a bit of a user interface form with a histogram, an image preview (preferably with clipping flashies), and EV adjustment slider and value adjustment controls, but would make this more resemble a full raw development plugin for Paint.NET!

Regards, Gordon

Link to comment
Share on other sites

@Moderator:Could you actually move this thread to publishing so that i don't have to copy all the info :D

Your wish is my command :D

Link to comment
Share on other sites

@GordonBGood: Thanks for all the information provided i know about the codec wrappers and i have used them in some other projects in this one i was trying to learn the namespace i mentioned which i why i did not consider it. I know about reflector normally don't do it in others code. Since normally my side projects are fully for entertainment and i liked to figure it out. My metadata code is similar to Rick's because we discussed about it in another thread. I'm going to do this fix but i won't have time to implement probably for two more weeks. You seem to be interested on this plugin so let me know if you want me to place it in codeplex and then more people can contribute. Again thanks for taking the time.

@Axel: Yeach i used the library for WicCop thanks for the link i think it could be useful for more people learning on this techniques.

@Ergo: Thanks :D

Link to comment
Share on other sites

By the way Caminova (the folks currently behind the DjVU format, if I understand correctly) have just published a JPEG 2000 WIC codec. It's not ready for prime time yet but it might be worth considering supporting it in your Paint.NET adapter, too?

Someone from their team posted a link on FPV's forum: http://www.fastpictureviewer.com/forum/ ... ?f=7&t=331 and there is also an interesting suggestion about a "codec enumerator" in the followup comments.

If you have all the enumeration code wrapped up and ready to go it sould be easy to hack together a simple applet that lists installed codecs, along with some information such as vendor name or guid, file extensions supported, version number etc in a listview. This could be an useful little tool.

Link to comment
Share on other sites

  • 1 month later...

Just to give an update on the status of the requested feature i'm going to do it the way axel is suggesting it. ETA For next week's friday.

Basically first time the plugin is run it will compile a list of all the codecs in your machine and added to a file in your user folder /appdata i will include a little tool that will be able to modify that information in order to say which ones you want and which ones you are not interested in.

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...

Hi,

Just tried it with NEF, NRW, CR2 and works great.

Axel (codec's author)

Hi I bought my first SLR ( a D90 )

And also bought the FastPictureViewerCodac and installed the plug in but can't get paint.net to load my NEF files.

I'm using paint.net 3.5.5 and the latest version of the codec.

The codec is working fine. I'm seeing my NEF files in windows picture viewer and I'm seeing my thumbnails.

Any advice on how to get the NEF files to load??

Link to comment
Share on other sites

  • 1 month later...
  • 7 months later...

Please forgive me. I'm a non-techie & need baby simple instructions:

1. Buy & download FastPictureViewer Codec Pack 3.1.

2. Install this plugin in Paint.net

Is awrload.zip the plugin to put in Paint.net? After extracting, does it go in Effects or File types?

Sorry for the dumb questions!

Link to comment
Share on other sites

Hey there awm03, welcome to the forum.

This plugin is a filetype plugin (that is - it extends the number of file formats that paint.net can load and save).

You need to unzip the file and copy the *.dll file(s) to the paint.net/filetypes/ folder. Then restart paint.net.

Link to comment
Share on other sites

  • 4 weeks later...

Hey there awm03, welcome to the forum.

This plugin is a filetype plugin (that is - it extends the number of file formats that paint.net can load and save).

You need to unzip the file and copy the *.dll file(s) to the paint.net/filetypes/ folder. Then restart paint.net.

Thanks so much for the specifics EER! Apologies for not thanking you sooner.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Alright guys i dropped the ball on this(If this happens again please mail through my website) I need to rewite this plugin to be compliant with the new Microsoft CODECS i will do that during next weekend if you guys haven't heard from me on September 11 feel free to go through my website and leave comments in my blog to remind me.

Will get to this and sorry.

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...