ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Photoshop plugin host

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format  BoldItalicizedUnderline Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailBrowse for an image to attach to your post Browse for a zip to attach to your post Insert CodeInsert QuoteInsert List


Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

Check here to subscribe to this topic.

T O P I C    R E V I E W
spetric Posted - Aug 04 2020 : 20:12:37

I have managed to rewrite and correct Photoshop plugin host (for 8bf filters) and the source code is available on GitHub:

It works with 32 and 64-bit plugins.

Before I create release (DLLs) and pack it together with source code, it would be nice if someone converts two headers to Pascal. That's only what needs to be converted so that engine can work from Delphi:


You can neglect #include "PITypes.h" in pspiGlobals.h as it's only used for uint32 (unsigned int 32-bit). The second file (pspiHost.h) actually contains APIs specification.

As you can see from description, engine supports ImageEn RGB+A format.

EDIT: #include "PITypes.h" removed from pspiGlobals.h, so only constants, one enum and three typedefs need to be converted. Regarding pspiHost.h, only API calls need to be converted.

18   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Feb 04 2021 : 06:15:15
Probably you are using 32bit plugins in 64bit version. This will not work.

If your app is 64bit then you will have to use 64bit plugins only.

Yogi Yang
klausdoege Posted - Feb 03 2021 : 04:16:35
Hi Spetric,
i use nigel's pspihost Demo, but the 64bitt dll work not realy ?
32bit program With 32bit dll

64bit program with 64bit dll

Can you Help ?

spetric Posted - Jan 09 2021 : 14:16:50

RC=5 means that filter is canceled.
This return code usually means that user has interrupted filter execution.

It also may occur in the first stage of execution (filterSelectorParameters).
It rarely occurs, but it seams that in this case filterSelectorParameters
has failed.

This may occur for several reasons, probably because filter requires
something that pspiHost.dll currently does not support (big document data, padding, etc..).
Dimon_II Posted - Jan 07 2021 : 19:11:30
I'm trying to use demo (5.0 and 6.3) version of Sattva Descreen.8bf plugin.
Filter works in Photoshop, Irfanview only works fine with version 5, but NiGulp display only "Error executing filter, rc = 5". What does this mean and can it be fixed?

xequte Posted - Oct 11 2020 : 23:52:00
Hi Sinisa

If you are happy with the current state, I will add a link to our download page.

Xequte Software
spetric Posted - Aug 13 2020 : 04:47:24
Hi Nigel,

Thanks for your time. Glad to see that it works.

I'll put new pas files to GitHub and also correct pspiSetMask API.
Nothing special, just added default arg values to 0, so when pspiSetMask is called without arguments, mask will be cleared. Of course, not mask created in application, just shared scanline pointers inside pspiHost.

As version 0.8 had a bug with setting mask (corrupting internal image scanlines, my wrong line of code), I'll also update source code and binaries on Github.

So far I've tested masking using Selection mask. Works with SelectionFeather and
also color picker call-back works (for plug-ins that have color picking feature). Only thing left is testing ROI (selection rectangle) in combination with mask.

I'll also add complete NiGulp application source code (NiGulp - opposite of PlugIn) to GitHub when I finish it, so if anyone wants to create wrapper class (C++/Delphi) for TImageEn can do it with minimal efforts.

With best regards,

xequte Posted - Aug 13 2020 : 02:41:50
Hi Sinisa

Yes, now it is working well.

I have corrected pspiGlobals.pas and pspiHost.pas. Please update git with these new versions.

The updated demo now enumerates the the \PlugIns\ sub-folder, and also shows progress. You can just double-click a filter to test it.

Xequte Software
spetric Posted - Aug 12 2020 : 05:32:12
Hi Nigel,

Some older plugins may not work. I've tried some in C# PspHost application written for and it also returned an error.

Here are plugins collection that work:

You can try Kyoto colors an Pixel trash as they have form with preview and controls.

From this collection, you can try Absolute Colors 1.2, Curves 3, Edges Fx, Grain Natural 2.

This site contains some good freeware (at the bottom of the page):

I would recommend trying 32-bit plugins first, as I did not covered some newest 64-bit plugin formats involving BigDocument structure (prepared but not yet implemented), although most 64-bit filters work OK:

NOTE: Before trying plugins, please download newest DLLs from GitHub as I've corrected some nasty bugs (writing beyond image buffer):

Also, I'll pack some working collection and upload the zip file.

I've also tried about, progress and enumerate APIs and they work correctly. On the upper image you can see how filters from given directory are enumerated: categories in one TListBox and filter names in another TListBox. When category is clicked, filters belonging to current category are put in TListBox.

With best regards,
xequte Posted - Aug 11 2020 : 19:26:55
Hi Sinisa

I changed the type of the ImgType parameter to integer rather than TImgType, which seemed to resolve it.

My filters don't seem to work though (get PSPI_ERR_FILTER_INVALID). Can you forward me some filters to try.

Xequte Software
spetric Posted - Aug 11 2020 : 03:16:47
Hi Nigel,

I've added a log in pspiSetImage API and here are results when loading an image
from PspiDemo.exe you've sent me:

image type: 768
width: 800
height: 600
imageBuff: 0AA9B040
imageStride: 2400
alphaBuff: 00000000
alphaStride: 0

Width, height, buffer and stride are passed correctly, the problem is image type, which is 768 (received by API)!? As TImgType enum ranges from 0 to 5,
pspiSetImage API returns PSPI_ERR_BAD_IMAGE_TYPE which is 15 (pspiGlobals.pas).

For testing purposes I forced correct type in DLL and it works fine:

Can you check what is the value in aType before it's passed to API.
We just need to solve that TImgType enum/type variable passing. The rest is obviously OK.


xequte Posted - Aug 10 2020 : 22:33:58
Hi Sinisa

I converted the demo, but wasn't able to get it to work. All the DLL calls get a non-zero result, e.g. pspiSetImage returns 15.

Xequte Software
spetric Posted - Aug 10 2020 : 04:22:18

__stdcall was definitively a bad idea because of MS name decoration.
Calling convention changed to cdecl, so to avoid decoration of APIs.

Delphi pas files corrected, OMF static libs (for Embarcadero C++) and release DLLs uploaded to GitHub (32 and 64 bit):

Demo code is still the same.
spetric Posted - Aug 08 2020 : 16:39:32

Here is a small demo (C++ source code only) and pspiHost.dll (32-bit).
There is nothing special in source code: loading image, few API calls
and that's it. Filter path is hard-coded. It's easy to convert that in Delphi.

For appropriate Delphi files, jump to: and download them.

Demo + 32-bit dll:

74.94 KB

If it works in Delphi, that's it.
If not, I'll change __stdcall to cdecl to avoid MS name mangling/decoration.
spetric Posted - Aug 08 2020 : 13:38:55
Hi Nigel,

Thanks for info. Anyway, I have added one API pspiSetImageOrientation and
before setting image to pspiHost, user can set image orientation (ASIS or INVERTED). It needs to be called only once in application.

However, I've noticed a problem (similar to scanner preview dialog problem I posted about) and that is styling non-VCL windows from VCL-styled application.
I will make a post on StackOverflow if someone can inform me about this strange

The same plug-in not only looks different but is also slow, especially when image is zoomed or panned...completely unusable, as it constantly repaints complete plug-in window.

Thanks again,
xequte Posted - Aug 08 2020 : 02:08:09
Hi Sinisa

There is an option in TIEBitmap to handle that too:

Xequte Software
spetric Posted - Aug 07 2020 : 18:17:59
Hi Nigel,

I thought of creating DLLs today, but I made one oversight.
Unlike OpenCV image Mat which has top-down scanline orientation,
ImageEn TIEBitmap and also ordinary TBitmap has bottom-up scanline orientation, which results in upside-down image in plug-in:

Not a problem, I have to add another parameter when setting image to pspiHost.
I'll add it tomorrow.

BTW, complete test program in Berlin 10.1 has less then 50 lines of C++ code.

With best regards and thanks again for converting header files,
spetric Posted - Aug 07 2020 : 16:01:55
Hi Nigel,

Thanks a lot. Ther is no need for cdecl, as the calling convention is stdcall, not cdecl. Also, there is no need for external PSP_API.

You can delete that as complete block. External keyword comes in implementation block. I'll put corrected version on GitHub. besides you, who else needs to be credited for conversion?

Here are converted spEngine headers corrected by William Miller.

4.76 KB

I have corrected as much as possible and upload it on GitHub (Additional/Delphi).

With best regards,

xequte Posted - Aug 06 2020 : 19:41:22
Hi Sinisa

It is mostly done, just need to work out the PSPI_API define.

2.02 KB

Xequte Software