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

Set all placed Photoshop images in bitmap mode to overprint? IDCS4

People's Champ ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

Hello,

Is there anyone familiar with the object model well enough to be able to help me with the following easily:

I need to go through all the placed images in the activeDocument. If the image is a Photoshop document in bitmap mode (1-bit mode), it needs to have it's Fill set to overprint (UI would be: Attributes Palette>Overprint Fill).

Any help would be much appreciated.

Thank you,

Ariel

TOPICS
Scripting

Views

2.1K

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
People's Champ ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

okay, here's where I am now:

mydoc= app.activeDocument.allGraphics[0].imageTypeName

This returns "Photoshop" if it's a Photoshop placed image. But, how do I figure out if it's in bitmap mode?

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
People's Champ ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

As this is urgent for me, I'm posting my slow progress, but if anyone can speed things up for me it really would be soo helpful!

okay, in the UI Info palette there is an entry called: Color Space. If the image is bitmap, this shows "Black and White". How do I access this in the object model? Color Space does not seem to be a property of graphic.

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
LEGEND ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

Hi Ariel,

I don't see a way within the DOM to find the color space of a placed

image. The only two ways I can think of off-hand is to have Photoshop

do that for you, or to parse the image file.

You might be able to figure it out with an educated guess based on the

file name (i.e. tif or jpeg, etc.) and file size as well.

Harbs

http://www.in-tools.com

Innovations in Automation

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
People's Champ ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

Hi Harbs,

Thanks for the reply.

I also haven't been able to find anything. But, I think that only bitmap

(1-bit) images have the property overprintFill.

Now I'm having a simpler problem of testing with a given image has that

property.

Using hasOwnProperty("overprintFill") always returns true. But trying to

read that property results in an error.

I've tried this, and it's not working:

mygraphics = app.activeDocument.allGraphics;

for (aa=0; aa<mygraphics.length; aa++){

if (mygraphics[aa].imageTypeName == "Photoshop"){

try{

alert (aa + mygraphics[aa].overprintFill);

mygraphics[aa].overprintFill;

mygraphics[aa].select();

exit();}

catch(e){};

}

}

Any ideas gratefully accepted.

Ariel

(And I hope you've got a lightning protector on your computer

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
People's Champ ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

Well, this seems to work, setting all placed Photoshop bitmaps to overprint. Provided I'm correct that only bitmap have an overprintFill attribute:

mygraphics = app.activeDocument.allGraphics;
for (aa=0; aa<mygraphics.length; aa++){
    if (mygraphics[aa].imageTypeName == "Photoshop"){
        try{
            mygraphics[aa].overprintFill = true;
            alert("Page: " + mygraphics[aa].parent.parent.name + " | Name: " + mygraphics[aa].itemLink.name);
            }
        catch(e){};
        }
    }

If anyone has any comments, I'd love to hear.

Thanks,

Ariel

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
LEGEND ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

Makes sense. They all have an overprint property, but you would only

be able to set the overprint property on a bitmap (as in the UI).

Harbs

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
People's Champ ,
Nov 17, 2009 Nov 17, 2009

Copy link to clipboard

Copied

Yes. But the only problem is that I'm not sure if bitmaps are the only

Photoshop graphics that have that property settable. In my case, I anyway

only have bitmpas and CMYK, so that's okay (I hope). But this script could

be doing unwanted things. I still wonder where InDesign gets it's "color

mode" information from (as displayed in the Info palette), and why it's not

accessible to scripting. I think it should be, no?

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Ariel,

you can apply "overprint" to grayscale images as well.

Uwe

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
People's Champ ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Oho! So can you think of anything which distinguishes a bitmap so I can

figure out with a script if the image is a bitmap?

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Hi, Ariel!
Try something like this (a bitmap TIFF image is selected):

if (app.selection[0].allGraphics[0].properties.toSource().match(/space:"Schwarzweiß"/g)=="space:\"Schwarzweiß\""){
    app.selection[0].fillColor="Yellow";
    };

Since I'm working with an german version of InDesign the space-property for an bitmap TIFF image is "Schwarzweiß". So figure out what the ESTK exactly tells you when you check with the properties.toSource()-method. It might be: match(/space:"bitmap"/g) which translates to:

if (app.selection[0].allGraphics[0].properties.toSource().match(/space:"bitmap"/g)=="space:\"bitmap\""){
     app.selection[0].fillColor="Yellow";
     };

Uwe

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Of course you need something like this:

if (app.selection[0].allGraphics[0].properties.toSource().match(/space:"Schwarzweiß"/g)=="space:\"Schwarzweiß\""){

    app.selection[0].allGraphics[0].overprintFill=true; };

The fillColor="Yellow" was for testing only.

Uwe

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
People's Champ ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Very good! In English it's: space:"Black and White"

Thanks for introducing me to the method toSource!

Ariel

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

You might want to add another if-statement:

if(app.selection[0].allGraphics[0].fillColor.name == "Black")

Because you can colorize a bitmap TIFF to any color of your swatches panel, it would be unfortunate to overprint a color like "Yellow" to a background color like "Cyan". The output you'll get would be a green. Imagine your overprinting bitmap TIFF overlaps different colors the effect might not what you want at all.

Uwe

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Oh, don't thank me for introducing you to the toSource()-method. Your thanks must go to Dirk Becker who introduced me to that method.

Uwe

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

LATEST

in VB I'm doing something like this:

If UCase$(myImgContainer.AllGraphics.Item(1).Space) = "RGB" Or _

   UCase$(myImgContainer.AllGraphics.Item(1).Space) = "CMYK" Or _

   UCase$(myImgContainer.AllGraphics.Item(1).Space) = "LAB" Or _

   UCase$(Right(myImgContainer.AllGraphics.Item(1).Space, 4)) = "TONE" Then

   ' color

else

   ' Gray / BW

end if

and if you want to check if your image is image or vector:

If myImgContainer.AllGraphics.Item(1).ActualPpi(0) = 0 Then

   ' not vector

end if

robin

www.adobescripts.co.uk

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
Community Expert ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

At least when they are TIFF images.

Uwe


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
People's Champ ,
Nov 18, 2009 Nov 18, 2009

Copy link to clipboard

Copied

Well, they're not. OTH, in this project there aren't any greyscale images

either.

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