Copier le lien dans le Presse-papiers
Copié
hi all,
can we retrieve the pixel value of channel mask using script.
i want retrieve the pixel value of each channel mask in the channels panel and store that details in json file.
thank you
Copier le lien dans le Presse-papiers
Copié
What do you mean by »pixel value of channel mask«?
• What pixel value?
• A Channel or a Layer Mask?
Copier le lien dans le Presse-papiers
Copié
for example pixel value of color or image.
so channel mask or layer mask is a pixel image. so i need to get the pixel value of that channel mask
Copier le lien dans le Presse-papiers
Copié
• What value/s? »pixel value of color or image« seems like a meaningless string of words to me.
• Which exact Channel/s in an image do you need to evaluate?
Please provide meaningful screenshots including all pertinent Panels to clarify.
Copier le lien dans le Presse-papiers
Copié
Individual Channels (if those are what you are referring to) have no color, as they are in themselves grayscale.
Collecting the values of all pixels in an image will most probably necessitate utilizing RAW-images because iterating the Color Picker Tool across an image is too slow, both @Paul Riggott and @jazz-y have posted code that employs this technique, if I remember correctly.
But I wonder if the Histogram might suffice instead … what are you actually trying to do, how and to what end are you going to process the information you want to retrieve, …?
Copier le lien dans le Presse-papiers
Copié
in the above fig. i have selected the channel. so what we are seeing in the page that i need to retrieve the pixel data of that channel mask.. so that i can store that details in json. after that we have one tool in that we need to display the channel mask exactly how it looks in the photoshop. so if i get the code to retrieve the pixel data of channel mask image, so that i can display the channel mask in our tool for every channel mask
Copier le lien dans le Presse-papiers
Copié
This description seems about meaningful but I don’t understand what this is about really?
that we have one tool in that we need to display the channel mask exactly how it looks in the photoshop.
Why employ another tool and not visualize the result in Photoshop itself?
Can that tool not simply process image data like tif, png, …?
In what exact form do you need the pixel data (not »pixel value« as you originally said)? Please post a sample.
Copier le lien dans le Presse-papiers
Copié
in that we also have channel panel in that we need display channel mask.. so when we load the channel mask , we retrieve details of pixel data which we stored in json file and then we display the channel mask..
can you please provide retrieving pixel data of channel mask ? is there any way to get it?
Copier le lien dans le Presse-papiers
Copié
Maybe you should post in your native or preferred language and we’ll see if auto-translation can help; as it is I find your posts not easy to understand.
What do you mean by »pixel data« exactly?
In which exact form do you need it if your other application is incapable of simply processing images?
Please provide an actual example.
Copier le lien dans le Presse-papiers
Copié
pixel data, like. channel mask and layer mask is a pixel image . so each channel mask have pixel values like
R 255 G 255 B 170 so like this. from this pixel value channel mask will be created.
the above image shows pixel values.. so through the script how to get that details of each channel mask and layer mask
Copier le lien dans le Presse-papiers
Copié
Again:
In which exact form do you need the pixel data?
Unless you want a document in which the numbers are arranged in a grid the images you posted seem meaningless.
Copier le lien dans le Presse-papiers
Copié
so in the above fig. i will selected path 1 from channels panel as u can see . so now i want to get that pixel data .
so i need pixel data in the form like , by using that data i should plot image from that data.. please find me which form of data that i need in this scenario?
or can we pull the rgb color data of each channel mask?
Copier le lien dans le Presse-papiers
Copié
Are you asking me what you need here?
I already asked you repeatedly, if you don’t know I am not sure how one could help you.
What is the actual problem you are trying to solve with that »one tool« you referred to?
Why employ another »tool« at all and how does Photoshop fall short for your needs?
What is that »tool«?
Copier le lien dans le Presse-papiers
Copié
hi @c.pfaffenbichler can we pull the rgb color data of each channel mask?
Copier le lien dans le Presse-papiers
Copié
Quite frankly this is getting close to appearing pointless to me.
Are you unwilling or unable to provide meaningful information?
I already posted a link to code @Paul Riggott had posted to get a list of Lab values from an Lab-image; one would need to adapt that for grayscale-images and create a new temporary image for each Channel but in principle it seeems possible to me.
Copier le lien dans le Presse-papiers
Copié
This would create a csv-file like this
from a grayscale image.
So you could duplicate all the channels into new files and save those temporarily (and delete them afterwards) to get the text files.
// getGrayscalePixelsValueViaRawBasedOnCodeByByPaul
// based on code by by paul riggott;
// 2023, use it at your own risk;
File.prototype.readByte = function() {
return this.read(1).charCodeAt(0);
};
function convertByteToSignedByte(num){
var dec = (num | (num % 256))-128
return dec;
};
function convertByteToLum( num){
var dec = Math.round((num/256)*100);
return dec;
};
function main(){
if(!documents.length) return;
if(activeDocument.mode != DocumentMode.GRAYSCALE) {
("Please convert this document to grayscale mode\r Then re-run this script");
return;
}
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
try{
var Path = activeDocument.path;
}catch(e){var Path = '~/Desktop';}
var rawFile = new File(Path +"/"+Name +".raw");
saveGrayscaleRaw(rawFile);
var csvFile = new File(Path +"/"+Name +".csv");
var len = 0;
var W = activeDocument.width.as('px');
CountW=0;
CountH=0;
rawFile.encoding = 'BINARY';
rawFile.open('r');
csvFile.open('w');
csvFile.writeln('X,Y,grayscale');
while(!rawFile.eof){
csvFile.write(CountW+',');
csvFile.write(CountH+',');
csvFile.writeln(rawFile.readByte());
len++;
if(len % W == 0){
CountH++;
CountW=0;
}else{
CountW++;
}
}
rawFile.close();
csvFile.close();
rawFile.remove();
}
main();
////// save raw from a grayscale image //////
function saveGrayscaleRaw (thePath) {
var desc4 = new ActionDescriptor();
var desc5 = new ActionDescriptor();
desc5.putString( stringIDToTypeID( "fileCreator" ), "8BIM" );
var idrawFormat = stringIDToTypeID( "rawFormat" );
desc4.putObject( stringIDToTypeID( "as" ), idrawFormat, desc5 );
desc4.putPath( stringIDToTypeID( "in" ), new File( thePath ) );
//desc4.putInteger( stringIDToTypeID( "documentID" ), 63 );*/
desc4.putBoolean( stringIDToTypeID( "copy" ), true );
desc4.putBoolean( stringIDToTypeID( "lowerCase" ), true );
desc4.putEnumerated( stringIDToTypeID( "saveStage" ), stringIDToTypeID( "saveStageType" ), stringIDToTypeID( "saveBegin" ) );
executeAction( stringIDToTypeID( "save" ), desc4, DialogModes.NO );
};
function saveAsRaw(file) {
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putString( charIDToTypeID('FlCr'), "8BIM" );
desc2.putBoolean( charIDToTypeID('ChnI'), true );
desc1.putObject( charIDToTypeID('As '), charIDToTypeID('Rw '), desc2 );
desc1.putPath( charIDToTypeID('In '), new File( file ) );
desc1.putBoolean( charIDToTypeID('Cpy '), true );
executeAction( charIDToTypeID('save'), desc1, DialogModes.NO );
};
Copier le lien dans le Presse-papiers
Copié
Found @Paul Riggott ’s post about using RAW-files on Lab-images to get a list of the Lab-values.
Copier le lien dans le Presse-papiers
Copié
Yep.
Look at the Imaging API, specifically the getLayerMask() method.
Trouvez plus d’idées, d’événements et de ressources dans la nouvelle communauté Adobe
Explorer maintenant