Copy link to clipboard
Copied
I receive about 1000 chart images daily that following images are two sample of my images:
Now i want to align values of charts using flip horizontal and use photoshop action or script to apply on 1000 daily images like following:
The left side of the chart bars does not need any changes and photoshop action can divide the images into two parts (left side of chart bars - other sides of chart bars)
next step of action after dividing images, the values on the right side of the chart bars should be selected with Color Range (dark color)
Now i have problem after above step. I must expand selection of values (that i selected by color range) to only left side and selections must extend to the edge of the left border of the layer.
After extending the selections to the leftmost point of the layer, i can convert each selection to specific layer and every layer can filp horizontal.
Finally with above steps photoshop action can align all of my images values.
Does anyone have any ideas to solve my problem?
Please help me in any way you can. If I don't find a solution to this problem, I will lose my job. My only hope is God and this forum and I hope to find a solution for this problem.
edited 2023-06-12
// moveNumbersLeftOfBarGraphs
// separate elements in specific graphics, put the bars right and align the numbers on the left;
// 2023, use it at your own risk;
var time1 = Number(timeString());
moveNumbersLeftOfBarGraphs ();
var time2 = Number(timeString());
alert("\nthe script took: "+((time2-time1)/1000)+" seconds\nstart "+time1+"\nend "+time2+"\n\n");
////// move numbers to left of bar graphs //////
function moveNumbersLeftOfBarGraphs () {
if (app.documents.length > 0)
...
This should perform at least somewhat faster if you want to give it a try:
// moveNumbersLeftOfBarGraphs
// separate elements in specific graphics, put the bars right and align the numbers on the left;
// ideally bars and logos should be colorful to make numbers better identifyable;
// 2023, use it at your own risk;
executeAction( stringIDToTypeID( "revert" ), undefined, DialogModes.NO );
var time1 = Number(timeString());
moveNumbersLeftOfBarGraphs ();
var time2 = Number(timeString());
alert("\
...
Copy link to clipboard
Copied
Does anyone have any ideas?
Copy link to clipboard
Copied
@c.pfaffenbichler
@Stephen_A_Marsh
You have already provided ideas to this conversation in a similar conversation. Please help if possible.
Copy link to clipboard
Copied
It seems unfortunate that you apparently have to rectify issues that people upstream from you refuse to rectify.
Are those images from the original post the actual images you received or did you damage them further?
Unless you made considerable Scripting-progress since the previous thread/s I doubt that you will be able to automate this.
Copy link to clipboard
Copied
It seems unfortunate that you apparently have to rectify issues that people upstream from you refuse to rectify.
Are those images from the original post the actual images you received or did you damage them further?
Unless you made considerable Scripting-progress since the previous thread/s I doubt that you will be able to automate this.
By @c.pfaffenbichler
Does manipulating the photos or not have an effect on finding a solution to this problem?
A few months ago, we made a lot of efforts in the previous thread/s and it did not reach a result, but I had no choice but to raise this problem again.
I put a solution that we did not discuss in the previous thread/s in the form of a ATN file in the last reply of this thread and I need consensus to complete it. If you have an idea to complete this solution, let me know. It may be the only solution to this problem.
Copy link to clipboard
Copied
Does manipulating the photos or not have an effect on finding a solution to this problem?
Naturally any additional damage to the images makes the task more difficult.
Again: Are those images from the original post the actual images you received or not?
I tried your Action on some of the old sample files and it didn’t work out for those.
What is the actual result you need to produce?
Because the Action seems to (for the one file on which it almost produces the result you posted a screenshot of) clip the bar graphs in height considerably.
Again utilizing a Work Path based on a Selection provides an option.
Copy link to clipboard
Copied
I tried attached action (atn file) to select right white bars but i don't know how to select only white bars and values without logos and colored bars. does anyone have any ideas to complete this process?
My ATN file is : https://drive.google.com/file/d/15EH-UjG-uS5Ze_q0YNoO7tPA3cxOsZZE
Copy link to clipboard
Copied
Maybe we should try to avoid getting bogged down in irrelevancies again.
Please provide
• a representative sample of the original images and
• the corresponding results you have produced and which meet your needs – aside from the numbers being on the right instead of on the left of the bar
Copy link to clipboard
Copied
Maybe we should try to avoid getting bogged down in irrelevancies again.
Please provide
• a representative sample of the original images and
• the corresponding results you have produced and which meet your needs – aside from the numbers being on the right instead of on the left of the bar
By @c.pfaffenbichler
I put three action files (ATN) with images specific to the action file for you. I hope you understand my method completely.
note that do not run the action files as batch, because many images are executed, and there is no close in the end of action files (i only show my method to select right side)
https://drive.google.com/file/d/1AhAUvGB9xiweyXyfBEkfarV-fc4i5hGF
Copy link to clipboard
Copied
The Actions are of no interest to me.
If they get you the results you need (aside from the flipping of bar graph and number) that’s just fine.
Please provide
• a representative sample of the original images and
• the corresponding results you have produced and which meet your needs – aside from the flipping
Copy link to clipboard
Copied
The Actions are of no interest to me.
If they get you the results you need (aside from the flipping of bar graph and number) that’s just fine.
Please provide
• a representative sample of the original images and
• the corresponding results you have produced and which meet your needs – aside from the flipping
By @c.pfaffenbichler
I have not yet found the final solution that I can provide you with the result it achieves! My solution has already reached 80% and I need some ideas for the remaining 20%. When the remaining 20% is completed, I can apply it to the chart images and get the result.
Copy link to clipboard
Copied
It seems there is no successful communication happening here.
I have asked for the files that meet your requirements EXCEPT for the flipping of numbers and bar graphs.
Is there something else that you are trying to achieve but not explaining in a way that I am able to comprehend?
Copy link to clipboard
Copied
the files that meet your requirements
By @c.pfaffenbichler
the chart images that meet my requirements are like following:
above image is edited of following chart image:
Copy link to clipboard
Copied
It seems I just fail to understand you, to me it seems you have been providing nonsensical or even wrong descriptions of what you are trying to achieve …
The upper image does not even feature the bar graphs, so why were you talking about flipping them with the numbers?
What is the state of the image you have managed to achieve so far (via Action and without manually selecting, clipping and moving) that needs the »remaining 20%«?
Copy link to clipboard
Copied
What is the state of the image you have managed to achieve so far (via Action and without manually selecting, clipping and moving) that needs the »remaining 20%«?
By @c.pfaffenbichler
see what is selected? selection must select only right white bars and values and then all selected areas must convert to seprate layer and then each layer must flip. all of this steps are 20%
The main problem here is that the selection also select the logos.
The upper image does not even feature the bar graphs, so why were you talking about flipping them with the numbers?
By @c.pfaffenbichler
After aligning the values, it will easily fill between the left and right values!
Copy link to clipboard
Copied
I have asked for files (original and what you consider your »80%«-version) again and again.
Not for screenshots but for the files.
After aligning the values, it will easily fill between the left and right values!
According to your description the numbers should be on the left so what do you mean by »between the left and right values«?
Copy link to clipboard
Copied
According to your description the numbers should be on the left so what do you mean by »between the left and right values«?
By @c.pfaffenbichler
I mean the values on the left side of the chart that don't need to be aligned and the values on the right side of the chart that need to be aligned. My English is very poor and I call both columns below »values«
I don't know what to call the left column
Copy link to clipboard
Copied
I have asked for files (original and what you consider your »80%«-version) again and again.
Not for screenshots but for the files.
By @c.pfaffenbichler
80% is situation in Photoshop and it has not yet reached 100% so that I can provide you with the file. I could just post a screenshot of photoshop situation or send you the action file with sample images.
Copy link to clipboard
Copied
80% is situation in Photoshop and it has not yet reached 100% so that I can provide you with the file. I could just post a screenshot of photoshop situation or send you the action file with sample images.
Either you provide the files I asked for (again and again) or I have to let this go.
I don’t intend to waste time trying to recreate what you are already satisfied with achieving via an Action so only those last »20%« are of interest to me now (changing the position of the bar and the numbers supposedly).
Either you provide those »80%«-files I asked for repeatedly already or I recommend you start a new thread (with a meaningful explanation and meaningful sample files) – that way you might attract the attention of others who might be able to understand you better and who might be able/willing to help you.
Copy link to clipboard
Copied
80% is situation in Photoshop and it has not yet reached 100% so that I can provide you with the file. I could just post a screenshot of photoshop situation or send you the action file with sample images.
Either you provide the files I asked for (again and again) or I have to let this go.
I don’t intend to waste time trying to recreate what you are already satisfied with achieving via an Action so only those last »20%« are of interest to me now (changing the position of the bar and the numbers supposedly).
Either you provide those »80%«-files I asked for repeatedly already or I recommend you start a new thread (with a meaningful explanation and meaningful sample files) – that way you might attract the attention of others who might be able to understand you better and who might be able/willing to help you.
By @c.pfaffenbichler
What do you mean by 80% files?
for example i have 1000 number of chart images in jpg format that I can edit 80% of each image by photoshop action, but how can i share the files that are 80% edited with you in this conversation? In what format should I export and share with you? (transparrent PNG, PSD or other...)
Copy link to clipboard
Copied
»80%«-files
By @c.pfaffenbichler
Sir, in the next few hours, I will share with you many examples of 80% edited files in transparrent PNG format. I hope I understood your meaning of the file correctly this time 🙂
Copy link to clipboard
Copied
80%«-files
By @c.pfaffenbichler
following zip file is 5 sample of 80% files in transparent PNG format.
https://drive.google.com/file/d/1oYzpYkNm2et_bvmkQmxliF0K5qyC7BOb
please note that our ultimate goal is to align values. So please apply any idea you have to these 5 samples to align values.
Copy link to clipboard
Copied
It seems a Script can handle this except in the cases where the bar is broken up by white parts in logos or flags.
Copy link to clipboard
Copied
E
By @c.pfaffenbichler
Maybe I completed the remaining 20% (see following). There is only one problem, how do I remove the white color in separate layers without merging the layers? I can select by color range but i don't know how to remove selected area without merging layers.
Copy link to clipboard
Copied
For the approach you posted a gif of last I see an issue with images like these:
The rightmost white area does not include the space that separates the bars and the logos.
And an approach that works based on the leftmost color area in each line will fail on images like these
where the logo/flag is part of the bar but has a vertical white part.
Anyway, if you want to pursue your Magic Wand Tool-approach this function this should demonstrate how to use a Layer’s Bounds to use the Magic Wand Tool via Script.
// apply magic wand tool a pixel off active layer’s top right;
// 2023, use it at your own risk;
if (app.documents.length > 0) {
var theLayer = activeDocument.activeLayer;
var theBounds = getBounds();
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
useMagicWand2022 ([theBounds[0][2]-1, theBounds[0][1]+1]);
// reset;
app.preferences.rulerUnits = originalRulerUnits;
};
////////////////////////////////////
////// use magic wand tool //////
function useMagicWand2022 (theCoord) {
var idnull = charIDToTypeID( "null" );
var idPxl = charIDToTypeID( "#Pxl" );
// select tool;
var desc2 = new ActionDescriptor();
var ref2 = new ActionReference();
ref2.putClass( stringIDToTypeID( "magicWandTool" ) );
desc2.putReference( idnull, ref2 );
desc2.putBoolean( stringIDToTypeID( "dontRecord" ), true );
desc2.putBoolean( stringIDToTypeID( "forceNotify" ), true );
executeAction( charIDToTypeID( "slct" ), desc2, DialogModes.NO );
// apply tool;
var desc2 = new ActionDescriptor();
var ref2 = new ActionReference();
ref2.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
desc2.putReference( idnull, ref2 );
var desc3 = new ActionDescriptor();
desc3.putUnitDouble( charIDToTypeID( "Hrzn" ), idPxl, theCoord[0] );
desc3.putUnitDouble( charIDToTypeID( "Vrtc" ), idPxl, theCoord[1] );
desc2.putObject( charIDToTypeID( "T " ), charIDToTypeID( "Pnt " ), desc3 );
desc2.putInteger( charIDToTypeID( "Tlrn" ), 30 );
desc2.putBoolean( charIDToTypeID( "AntA" ), true );
desc2.putBoolean( stringIDToTypeID("merged"), true);
executeAction( charIDToTypeID( "setd" ), desc2, DialogModes.NO );
};
////// bounds of active layer //////
function getBounds () {
var ref = new ActionReference();
ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("bounds"));
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
var theBounds = layerDesc.getObjectValue(stringIDToTypeID("bounds"));
var theseBounds = [theBounds.getUnitDoubleValue(stringIDToTypeID("left")), theBounds.getUnitDoubleValue(stringIDToTypeID("top")), theBounds.getUnitDoubleValue(stringIDToTypeID("right")), theBounds.getUnitDoubleValue(stringIDToTypeID("bottom"))];
var theW = theBounds.getUnitDoubleValue(stringIDToTypeID("right")) - theBounds.getUnitDoubleValue(stringIDToTypeID("left"));
var theH = theBounds.getUnitDoubleValue(stringIDToTypeID("bottom")) - theBounds.getUnitDoubleValue(stringIDToTypeID("top"));
var horCenter = theseBounds[0] + theW / 2;
var verCenter = theseBounds[1] + theH / 2;
return ([theseBounds, theW, theH, horCenter, verCenter])
};