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

How to remove everything except numbers from chart images?

Explorer ,
Feb 27, 2023 Feb 27, 2023
 

I receive about 500 to 1000 photos of charts or graphs on a daily basis that i have to remove all the components of the photos except their numerical values. 

 

This is an example of my photos: 

001.jpg 

I select graph bars using Magic Wand Tools in Photoshop

002.jpg 

Then move selected area to between logos and the numerical values

003.jpg 

And finally, by removing the various components of the images, only numerical values remain

004.jpg 

I have to do these steps with Photoshop action feature because the number of my daily photos is very high. 
I can do these steps with action feature automatically if the distance between the edge of the graph bars and the first digit of the numerical values is the same in all images. but the main problem here is that the space between the numerical values and the graph bars in the images received daily is not the same

 
For example, this is another photo where the distance between the numerical values and the bars of the graph is very close: 

005.jpg 

If I apply the steps I went through for the previous image using Photoshop action feature on this image, surely some of the numerical values will be removed in this image. 

 

How can I delete all the components of my daily images except the numerical values through the Photoshop action feature? 

Can I move selected area exactly to before the numeric values using the Photoshop script

 

Note: 

  1. I can't use Photoshop Color Range tool for selecting numeric values because numeric values have same color as the rest of the image contents. 
  2. My daily images have a single layer and are not smart objects
  3. number of images received daily is very high and I cannot do it manually. I must do it with Photoshop action feature or another automatic solution. 
  4. I can't use OCR tool because some of the images contain some logos that contain letters or numbers. If the logo numbers are extracted and combined with numerical values, it is not possible to find the extracted logo numbers. 
  5. The space between the graph bar and numerical values in each image is specific and this distance is different between different images. 
  6. The space between the graph bar and numerical values in a photo is the same. 
  7. All my images resolution is same 
  8. It is not a problem if resolution of the photo are changed. 
  9. I know that the explanation I provided is complicated, but I could not express my problem more simply than this. 

 

I have been facing this difficult problem for about three months and I hope I can find a solution here 

 

Sorry if there are any spelling errors in the text because my English is very poor. I wrote this text with the help of Google Translate.

TOPICS
Actions and scripting , Windows
19.7K
Translate
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
Community Expert ,
Feb 27, 2023 Feb 27, 2023

Some very quick experimentation lead to this (which can be automated), further minor cleanup may then be required - such as the "g":

 

cleanup.png

 

Instead of layers, one could work with channels and or in grayscale mode instead of RGB which could possibly speed things up slightly.

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

I implemented the method you said on this photo, but I did not get good results: 

Untitle324324324324d.jpg

Translate
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 ,
Feb 28, 2023 Feb 28, 2023

Results will vary, I don't have a magic answer, here is another sample using the same method:

 

005.jpg

 

005.png

Translate
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 ,
Feb 28, 2023 Feb 28, 2023

An only slightly different approach: 

Screenshot 2023-02-28 at 09.41.19.png

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

good idea - i will test this with action on 500 - 1000 photos and check results. I will announce the result here

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

It is a very good method for my work, but it has some problems. For example, I tested the filters for another photo of the charts and some piece of the logos were not deleted: 

Untitled342424.jpg 

Even by increasing or decreasing the values of the filters, they were not cleared! 

Can filters be set for numbers? It means the opposite of what we did 
 

Translate
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 ,
Feb 28, 2023 Feb 28, 2023

Yeah, especially lines of comparable thinness will be a problem. 

 

So far Photoshop simply does not offer a feature for properly recognizing specific letters or numbers. 

 

Are the numbers always 8 or 7 digits long? 

It might be possible to determine the lines and, if the numbers are always about equally wide, use the rightmost number in every line as the basis for a Selection. 

Do you have Photoshop Scripting experience? 

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

no i have not Photoshop Scripting experience - i used only ready scripts before 

 
no, numbers maybe 3 or 4 digits long. 

 

can use script to convert all selection to specific layer and then delete the two rows on the left using script? Or keep only the right column rows? 
 
Untitled53535345345.jpg

Translate
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 ,
Feb 28, 2023 Feb 28, 2023

That’s actually a good idea. 

But I see practical problems – some of the lines’ elements merge (line 4 and 5, both the blocks and the icons). 

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

no problem. can test script on this photo:  

Untitled534534534534535.jpg 

I check the photos for elements merge before using the script

Translate
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 ,
Mar 01, 2023 Mar 01, 2023

can test script on this photo:  

Do you have experience with JavaScript and Photoshop Scripting? 

Translate
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
Explorer ,
Mar 01, 2023 Mar 01, 2023

yes i have. but only i can use ready scripts and i don't know javascript. 

for example today i found and tested this script from github: 

https://github.com/ES-Collection/Photoshop-Scripts/blob/master/Split%202%20Layers.jsx

 

i tested on this image: 

Untitled534534534534535.jpg 

but i have some problems: 

1) after remove white background and split all photo components to specific layers, i don't know how can i auto select two left raw column layers by photoshop action! - I actually don't know how to delete all layers except the numeric value layers

2) selecting background with magic wand tool and then inverse it, all photo components will select but in this case, all numbers of numerical values are converted into a separate layer. I don't know how to convert each numerical value to a layer? 

3) if i use expand to merge numbers selections maybe it merge with logos selections: 

k5454555434.jpg 

4) can edit that script to convert two left rows to each layers and delete them? Selecting all photo components takes more seconds and is not suitable for 500 or 1000 photos.

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

i must select background using magic wand tool and then inverse selection to select all image contents then expand selection 1 or 2 pixels so that a small amount of white color surrounds the content of the photo. Finally, change the background color to red: 
Untitle5435345d.jpg 

Here we need a script to segment the image based on red color and each segmented segment into a separate layer. The photo will probably be split into three columns, and the script should remove the two leftmost columns to leave the column of numeric values alone. 

Finally, we return the background color and the deleted values to white. 

I don't know how to find or create such a script.

Translate
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 ,
Feb 28, 2023 Feb 28, 2023

Who creates the photos? 

What is the program in which the numbers are originally displayed? 

Is there any possibility to get the source data or images in a format that can maintain type-content like pdf? 

Translate
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
Explorer ,
Feb 28, 2023 Feb 28, 2023

The company I work for has requested me 
 
I don't know what program it was made with - I was just given a photo of the graphs 

 

NO, There isn't any possibility.

Translate
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 ,
Feb 28, 2023 Feb 28, 2023

Well, that sounds a bit like a case of »gigo«. 

 

For what and how are the images you edit to be used afterwards? 

I wonder if it might be worth to use Acrobat’s OCR, though I am not sure if that could be effectively automated. 

 

Translate
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 ,
Mar 01, 2023 Mar 01, 2023

You may not be able to fully automate this in Photoshop.

I would look at ImageJ and ask on their forums, this is more of a pattern-matching problem that might be doable with a script there.

https:\\imagej.org

Translate
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
Explorer ,
Mar 01, 2023 Mar 01, 2023

I mentioned in the replay that I did above that with the following script you can convert different components of a photo into several layers, but the main problem is deleting the two rows of the left layer. How to automatically delete the two rows of the left layer? 
https://github.com/ES-Collection/Photoshop-Scripts/blob/master/Split%202%20Layers.jsx

Translate
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 ,
Mar 01, 2023 Mar 01, 2023

Perhaps the bounds of the layers that have been separated could be used. If the layer bounds are greater than the numbers height value delete them in a loop.

Translate
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
Explorer ,
Mar 01, 2023 Mar 01, 2023

I do not understand exactly what you mean. Can you record a video so I can see what you are doing? and post video here

Translate
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 ,
Mar 01, 2023 Mar 01, 2023

Sorry, I was speaking out loud to the other script writers.

Translate
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
Explorer ,
Mar 01, 2023 Mar 01, 2023

I noticed that all the numbers have the same height, but the rest of the image components have either higher or lower - how can I select the components of an image based on height?

Translate
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
Explorer ,
Mar 01, 2023 Mar 01, 2023

You can't choose based on the height because the height of some logos may be exactly the same as the height of the numbers! - This is the biggest problem I have ever had with automatic image editing!

Translate
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
Explorer ,
Mar 01, 2023 Mar 01, 2023

If I can't do this automatically, I will lose my job.😭😭 Please help me in any way

Translate
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