count the pixels?

I am new to scripting and is so confusing. I was wondering if someone here would know where I could find a script for the export of histogram information? Basically, I have hundreds of files with 30 + layers in each file. I need to know how many pixels is present on each layer. manually, I do this by selecting each layer and check the pixels of the layer selected in the Histogram palette and write it down. If, instead, I could export this info to the database or file of a Word, that would allow me to save a lot of time. I'm working on with CS2. grateful for any help!

You can try this, it will write the number of name and pixel in the layer to a csv file on the desktop with the same name as the opened document.

if(documents.length){
doc=activeDocument;
var area = activeDocument.histogram;
var Results=[];
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var CSV=File("~/desktop/"+Name+".csv");
findLayers(doc);
Results = Results.reverse();
CSV.open("w");
for(var a in Results){
CSV.writeln(Results[a][0]+","+Results[a][1]);
 }
CSV.close();
}
function findLayers(obj){
 if(obj.artLayers.length>0){
 for(var z = 0;z 0){
  for(var l=0;l 
         

Tags: Photoshop

Similar Questions

  • count the pixel values in an array

    Hello

    I converted my image into a 2D array, then I use the array subset function to return the subarray of my columns in 1023.

    Now I want Rich Textlike to analyze my image vertically in a column to add the pixel values in each column and return the result for each column. So I would like to extract the indexof the minimum value, which is what I'm looking for.

    I have an idea please let me know.

    enclosed please find my vi

    Thank you

    Looks like you are doing things the hard way.  Instead, I suggest using IMAQ LinearAverages rather at the entrance of the rectangle in option.  This will give you the average of each column, which is just the total divided by the number of pixels.  You can then use the Min search the index of the smallest value table.

    Bruce

  • Scripting: Count the number of selected pixels (non-quadrangle) or alternative approach

    Is it possible to count the number of pixels in a selection that is not a quadrilateral? For example, if I have cntl - click on the thumbnail of a text layer, I would like to know how many pixels is selected.

    This application, if anyone has another approach to try...

    Untitled-1.jpg

    My goal is the place the text at some point where it covers do not all lines (or, Alternatively, the place where it covers the smallest number of pixels line). My approach is to insert a text in red to the desired location, apply a BlendMode.Multiply to the text. The number of Red pixels always on the screen will show how many pixels line I'm concealing. Then I move the text into a region and check the histogram in 76 index (which is 255,0,0), find the point with the highest number of red (meaning concealing pixels less line) and finally move the text at that location. See the code snippet below:

    var bestCX = cX;

    var bestCY = cY;

    var bestPixelDensity = - 1;

    var pixelDensity = 0;

    var searchRegionWidth = 3000;

    var searchRegionHeight = 2000;

    loop through an area 3000 x 2000 around where you want

    for (var x = cX - searchRegionWidth/2; x < cX + searchRegionWidth/2; x ++)

    {

    for (var y = cY - searchRegionHeight/2; y < cY + (searchRegionHeight/2); y ++)

    {

    textItemRef.position = new Array (x, y);

    pixelDensity = myDocument.histogram [76]; index of 255,0,0 (red)

    If this point is greater than the previous highest density, use it instead.

    if(pixelDensity > bestPixelDensity)

    {

    bestCX = x;

    bestCY = y;

    bestPixelDensity = pixelDensity;

    }

    }

    }

    move text in the best location found

    textItemRef.position = new Array (bestCX, bestCY);

    The problem is that the images I use are very large ((7000x7000px) for each histogram control takes a few seconds and I really need to move in a fairly large region (3000 x 2000) to find the best place.) I think that it is perhaps faster if I'm not using the histogram at all, and instead each time that I move the text, I select the text and see how many points is in the selection. Any help or alternative approaches would be great!

    I don't know the answer, the only thing I can think is the whole of the histogram to the selection and treatment of the histogram of the selected area.

  • Charger changes the pixel value after loading as bitmap

    Hi all

    My goal is to load two images and compare its color pixel-by-pixel information. For this I used "flash.display.Loader' class to load the images, and once the load finished I catalogued the content loaded bitmap object (loaderObj.content as Bitmap). Finally, I'll get the bitmapdata of the bitmap of the two images and compare the pixels.

    Now the problem is the color of the original image information and the loaded bitmap is slightly different. For example, the color value of the pixels of the image attached image1.jpg is 0xDDDDDD for full 1366 x 768. And for the image even when it is loaded as bitmap color value of pixels are different from the original value (for a few pixels only, not all pixels are different).

    I gave you the source code and sample images.

    Please can someone help me how to solve this problem?

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:WindowedApplication ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx".

    width = "1376" height = "800."

    ShowStatusBar is kept = "false" >

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < fx:Script >

    <! [CDATA]

    private function loadBtn_ClickHandler (): void {}

    var file:File = new queue (File.desktopDirectory.nativePath);

    file.addEventListener (Event.SELECT, onFileSelectionHandler);

    file.browseForOpen ('open image', [new FileFilter ("Images", "*.gif, *.jpg; *.JPEG; *.png")]);

    }

    private void onFileSelectionHandler(ev:Event):void {}

    var loadedFilePath:String = (ev.target as a file) .nativePath;

    loadImageAsBitmap (loadedFilePath);

    }

    / * Load the bitmap image using the loader * /.

    private void loadImageAsBitmap(url:String):void {}

    var loader: Loader = new Loader();

    load the content as a bitmap

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onContentLoadComplete);

    loader.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, onContentLoadFail);

    Loader.Load (new URLRequest (url));

    }

    private void onContentLoadComplete(ev:Event):void {}

    var loaderInfo:LoaderInfo = ev.target as LoaderInfo;

    var bitmap: Bitmap = loaderInfo.content as Bitmap;

    printPixelValue (bitmap.bitmapData);

    container_ID. AddChild (bitmap);

    }

    private void onContentLoadFail(ioe:IOErrorEvent):void {}

    trace ("Image Load Failed");

    }

    private void printPixelValue(bmData:BitmapData):void {}

    var initPixelValue:Number = - 1;

    for (var countI:int = 0; countI < bmData.height; countI ++) {}

    var countI:int = 1;

    for (var countJ:int = 0; countJ < bmData.width; countJ ++) {}

    var pixelValue:Number = bmData.getPixel32 (countJ, countI);

    If (pixelValue! = initPixelValue) {}

    initPixelValue = pixelValue;

    Print pixel value for a single line

    trace ("value of Pixel to" + countI + "x" + countJ + "is:" + pixelValue);

    }

    }

    trace ("value of Pixel to" + countI + "x" + countJ + "is:" + pixelValue);

    //}

    }

    []] >

    < / fx:Script >

    < s:Button id = "loadBtn_ID" label = "Load!" click = "loadBtn_ClickHandler ()" "

    x = '5' y = "5" height = "20" / >

    < mx:UIComponent id = 'container_ID' x '5' = y = "30" width = "1366" height = "768" / >

    < / s:WindowedApplication >

    Sample image:

    main.jpg

    Thank you all,

    Update the sdk to 4.6.0 fixed the problem

  • Count the colors in photoshop?

    Hello


    I am have created a grid in photoshop consisting of about 60 colors and I need an accurate value for the number of squares that are assigned to each color. The reason for this? I do a carpet and need to calculate how much wool I need to complete it! However, the histogram-> route number of pixels does not work for me (Oh how I tried!) that I've used a mosaic filter on the image. Therefore, the places I'm highlighted with the magic wand tool do not count for a pixel of each... does make sense? and if it isn't... is there a way around this without going me nutty and having to count the entire image of the eye!


    Please save my sanity!


    Thank you

    Well, the number of pixels histogram should work. Assuming you regular shaped areas. I took a photo and a mosaic of 45 pixels, put on it. Then when I select a square 45 x 45 = 2025 pixel and when there were two squares of the same color of the histogram shown 4050 pixel.

    If you need to just their total of and divide by anything that has a unique place.

    Just a bit of mathematics...

  • How can I find the number of pixels is in my photos of the ipad? I sell on ebay and they have new requirements for the photos. 500 pixels on the longest side. Is it possible to increase the pixels on already took pictures?

    How can I find the number of pixels is in my photos of the ipad? I sell on ebay and they have new requirements for the photos. 500 pixels on the longest side. Is it possible to increase the pixels on already took pictures?

    See if this application works for you > https://itunes.apple.com/us/app/image-size/id670766542?mt=8

  • How can I count the custom order?

    I'm counting the number of names that appear in all the columns in the table

    Each cell contains the name of a single individual, like the first column: 1-01, the second columns: 1-02, etc.

    Can someone help me with the formula to measure? What would be the correct formula for this?

    Thank you very much.

    Hi the learner,

    "I'm trying to count the number of names that appear in all the columns in the table

    Each cell contains the name of a single individual, like the first column: 1-01, the second columns: 1-02, etc.. »

    Your goal is not clear.

    What do you mean by ' count number per ordercustom?

    You want a single indictment which only has the names that appear in each column?

    Do you want counts of the number of names appearing in each column (ie. a separate head for each column)?

    You want a counter of the number of all the names on the table?

    Or is that what you want different from all this?

    "Each cell contains the name of a single individual."

    Not mean there is no empty cell?

    This means that there are no cells that contain data that is not the name of an individual?

    I do not understand the connection between "1-01", "1-02 ' and the names in the cells.

    Please specify.

    Kind regards

    Barry

  • To count the instances of the text in a group of cells?

    I am converting an Excel document. I used a table in Excel to count the number of times wherever a word of the text appeared in a group of cells. The table does not have in numbers. How do I do this in numbers?

    Hi Bruce,.

    Using the SUBSTITUTE function is a common way to do it. Could you post your Excel formula?

    SG

  • How can I increase the pixel size in iphoto

    Hi, I'm trying to increase the size of the pixel in iphoto - they need to have a minimum of 500 that can be used on ebay.  Any ideas?

    Photos does not increase the size of the pixels when exporting.  You get just the size of maximum pixels is your photo.

    Try this web page: http://www.imageenlarger.com

    The image enlarger tries to fill in pixels without blurring the picture.

    A quick and dirty method would be to zoom on your photo in pictures and take a screenshot.

  • How to count the number of conditionally highlight cells in a column or row

    I'm working on a table to identify problems with my credit rating. So, I have a column that indicates the due date on the invoice and G that contains the date to which I made the payment.

    I'm trying to follow how many times I'm late with payments. I want to improve.

    So if the G column is later than column D, both with the Date formatting. So, now I've highlighted cells and I want to summarize for the year, how many times I was late payments.

    I thought a column G to count the number of days before or after that back I was with payments. But if the sum, it only gives me no useful information. I guess I could count the number of cells with values less than 0.

    I prefer to be able to put in the summary column for G something that said 0-12 years ago has highlighted cells in the column.

    Thank you

    You can not count based on sharing or formatting.  You can, however, be based on the same conditions.

    There are functions:

    COUNTIF() counties based on a condition is true

    and

    COUNTIFS() based on several conditions being true

    = NB. If

    Here is a way.  IT will take an additional column that calculates the "delay" in the days of a payment

    the first two lines are the lines of header

    H3 = IF (COUNTA (D3, G3) > 1, MAX ((G3−D3) DUR2DAYS, 0), "")

    It's shorthand dethrone select cell H3, and type (or copy and paste it here) the formula:

    = IF (COUNTA (D3, G3) > 1, MAX ((G3−D3) DUR2DAYS, 0), "")

    Now select cell H3, copy

    Select the H3 cells at the end of column H, dough

    H1 = "payments late =" & COUNTIF(H,">0")

  • How can I change the pixels for photos on the iphone 6? IOS 9.1

    How can I change the pixel for photo taken on my iphone 6? 9.1 IOS I opened the camera and there only HDR power...  Help, please!

    You do not change the pixel setting.

  • How to count the edges within the great period of door?

    Hello

    I use a PXI-6624 counter/timer in Visual Studio C++ with Meassurment Studio.

    I want to count the edges on a signal within a high period of an input signal.
    I found the documentation entries "CTR n CBC", "CTR n GATE" and "CTR n to THE.

    My idea is simply configure the counter 0 to count the edges on CBC by blocking via DOOR.
    can be an example to my problem in the installation of nor, but above all I do not understand the description of landscaping.
    to find a good example, you must know the name of the function you want to use.
    can someone tell me the good examplename for my problem?
    What call configuration should I use?

    a little less important than my first problem is a similar.
    I want to count the edges on a signal between a start trigger and a relaxing stop.
    SRC-> signal
    DOOR-> start signal
    To THE-> the stop signal

    I found a way to count the edges of the internal clock between start and stop (2 Seperation of edge), but not for an external signal.

    can someone help me with this? especially with the first.

    B

    Hi John,.

    Thank you for your help. It works very well.

    I had a few problems with how the timebaseSource should be implemented.

    Finally, I found the solution.

    for those who do not want to search long for the code, it is here:

    Create the task
    CNiDAQmxTask ("CITask") m_task;

    Create the meter inlet channel
    m_task. CIChannels.CreatePulseWidthChannel ("PXI1Slot16/ctr0", "",)
    atof (minimum), atof (maximum), startingEdge,
    DAQmxCIPulseWidthUnitsTicks);

    Retrieve the channel to change

    CNiDAQmxCIChannel chan is m_task. CIChannels.GetAll ();

    Fix the DOOR Signal
    Chan. SetPulseWidthTerminal("/PXI1Slot16/PFI38");

    The value of the Signal SOURCE counton
    Chan. CounterTimebaseSource = ' / PXI1Slot16/PFI39 ";

    CNiDAQmxCounterReader myCounterReader (m_task. Stream);
    Double measuredWidth = myCounterReader.ReadSingleSampleDouble ();

    Thank you and goodbye

    B

  • Count the number of zero terms between non zero terms

    Hello.  I have a table of data of zero and nonzero (example: {1 2 56 2 3 0 0 0 0 0 2 3 5 2 3 5 2 0 0 0 0 32 43}) I need to count the number of zeros of each string of zeros and mark that number against the first zero no term following the string of zeros (NOTE (: string is used here as a description of a series of zeros, not a string variable).  So the plot which coordinates since my example would be (5.2) and (4.32).

    I'm clear on the way to the path, but I am unable to store only each final count of consecutive zeros without having unnecessary data in my plot.

    Thanks in advance to all those who have advice!

    -Mike

    Do something like that?

    EDIT: Minor Correction because of the additional function of decrement.

  • How to count the number of edges using counters SMU-6363

    Hello

    I'm counting the number of edges in a test signal in a duration of 50 Ms I use the SMU-6363 map and connect to the TRC test signals 0 SRC (PFI 8). Is that a correct connection? What else do I need hardware wise be a correct set for this application?

    Thank you

    Jeet

    Hi Jeet,

    This configuration is correct. Hardware wise, that's all you need to do.

    Kind regards

    Jorge Fernandez
    Technical sales engineer
    National Instruments
    ____________________________________________
    Certified LabVIEW Associate Developer (CLAD)

  • Count the edges of the 2 signals TTL (Heidenhain linear scale)

    Hi all

    This is my first post here. :-)

    Currently, I'm doing a VI to be used with a linear scale. The linear scale gives 2 TTL signals that have an offset of 90 °. The change in distance of the linear scale is given by counting the fronts and edges of the two signals. See the following image: Ua1 is signal 1 and signal 2 Ua2. You can ignore the other signals.

    Now, I want to count the 4 edges in order to translate the 2 signals in the distance. This means that I need advanced two counters for Rising-rising, Rising-Falling Falling Falling, falling on the rise for 2 signals. I tried to do 4 points two counters in LabVIEW but that of course does not work, because an acquisition of data can access the card TTL or I did it wrong.

    Once I have to handle this, I also want to understand the meaning.

    My card TTL: NI 9402

    My electronic Heidenhain interface: 100 IBV (http://www.heidenhain.com/fileadmin/pdb/media/img/598_160-23.pdf - also at the origin of the image)

    Hardware configuration: linear scale-> IBV (Elektronic Interface)-> NI 9402-> LabVIEW

    Signals: Analog 3-> 3 TTL-> OR 9402

    I hope I do not double post. Any help would be greatly appreciated.

    I used Heidenhain linear scales in many applications.

    As stated in the previous post, the output of your balance is as a quadrature encoder. Therefore, you must use an entry of the DAQ card counter to measure the position of the scale.

    The desired X 4 mode is done by the meter itself (not possible with some old maps of OR).

    As starting point, see measure angular Position.vi that comes with examples of LabVIEW. On your linear scale, change the type of the polymorphic DAQmx create channel VI CI linear encoder and etiquette of pulses per revolution at a Distance by pulse.

    Feel free to post back if you need further assistance.

Maybe you are looking for