• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

changeMode() or Conditional Mode Change in C#

New Here ,
Jun 22, 2009 Jun 22, 2009

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Advisor ,
Jun 22, 2009 Jun 22, 2009

Copy link to clipboard

Copied

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

-X

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 22, 2009 Jun 22, 2009

Copy link to clipboard

Copied

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 22, 2009 Jun 22, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 22, 2009 Jun 22, 2009

Copy link to clipboard

Copied

I've tried with the null parameter. My Errorlog shows following:

General Photoshop error occurred.- Der Befehl "Konvertierungsmodus" ist zzt. nicht verfügbar.

in english something like:

General Photoshop error occurred.-the command "ConvertMode" is currently not available

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 22, 2009 Jun 22, 2009

Copy link to clipboard

Copied

What's the original mode and bit depth of the document? Can you convert it manually?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 23, 2009 Jun 23, 2009

Copy link to clipboard

Copied

Originalmode ist bitmap and is none given. the controls at picture -> mode -> 8-bit / 16-bit are greyed out.

I can convert it manualy with the conditional mode change automatisation or save for web as jpeg.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 23, 2009 Jun 23, 2009

Copy link to clipboard

Copied

LATEST

Well I solved it but a little bit different.

I used the scriptlistener to record a conversion of a sample file. then used the minimal customized log-file as JS script called via .DoJavaScriptFile(..).

Thank you for your help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines