Skip to main content
Participating Frequently
June 22, 2009
Question

changeMode() or Conditional Mode Change in C#

  • June 22, 2009
  • 1 reply
  • 1948 views

Hello everybody,

I'm running a windows-service using Adobe PShop CS 3 for graphics conversion.

But for some graphics my conversion fails. I figured out that the problem is the Colormode.

If its set to RGB everything is fine but when the source-graphic has colormode bitmap it fails.

now I have to convert every graphic to rgb before conversion. I found the changeMode() method in the photoshop interop package, but theres a problem with the second parameter :

mobjDoc.ChangeMode(PsChangeMode.psConvertToRGB, Object Options)

How to build a proper options-Object for this command?

and is there any API or something similar for the Photoshop.Interop

A fallback solution would be scripting with the conditional mode change script. but I have no idea to implement it in a propoer way so no user interaction is needed.

A other fallback solution would be the save for web option or saveAS jpeg.... but there is no save for web method in c# and the saveAS could not save as jpeg 😞

thanks in advandce

Best regards

Moritz

This topic has been closed for replies.

1 reply

Inspiring
June 22, 2009

You shold only need the second argument to changeMode if you are converting to bitmapped or indexed color images.

-X

moritz235Author
Participating Frequently
June 22, 2009

i think you got me wrong.

i need to know what object to pass to the method. and how to build it.

e.g.:

SerchedObject myObject = new SearchedObject();

myObject.setParam1 = true;

myObject.setParam2 = whatever;

myPicture.ChangeMode(PsChangeMode.psConvertToRGB, myObject);

....

I also tried this with no result:

myPicture.ChangeMode(PsChangeMode.psConvertToRGB, null);

Inspiring
June 22, 2009

If you are converting to RGB, there is no second object to pass. I have no idea how to express that in C#. In JS, you either don't put anything or you pass undefined which is almost the same as null.

-X