Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to write a GIMP script for processing artwork
#1
Photo 
Hi, Everyone,

This is my first post here, so I hope I'm doing it correctly.

I make drawings of astronomical objects - galaxies,star clusters,planets, etc.,  through my telescope. After finishing a drawing, I scan it and process it in GIMP. The results are posted online in web sites like CloudyNights.com

There are about 20 steps in the process, so I would like to be able to automate the process. According to the GIMP manual, this can be done in Python.

Here are the steps, after the pencil drawing has been finished:

Scanning:

1. Slide drawing into scanner.
2. Adjust light and shade for grayscale scan.
3. Scan drawing.
4. Remove drawing and repeat above steps for next drawing.

GIMP Processing:

1. Open scanned drawing in GIMP.
2. Invert black and white.
3. Select circle for field of view.
4. Invert circle selection.
5. Use Color Picker tool to determine color of background around selected circle.
6. Use Paint Bucket tool to cover background with selected color.
7. Export modified image and save.
8. Close view.
9. Re-open image and select "New Layer".
10. Select Paintbrush tool (12 - 20px) to place "stars" over the drawn stars on the bottom layer.
11. Return to bottom layer.
12. Use Color Picker tool to select color of field-of-view background.
13. Use Paintbrush tool, at 20px size, to paint over stars on bottom layer.
14. Choice: Return to top layer and use various paintbrush tools to modify or enhance the object (galaxy, star cluster, etc.) OR remain on the bottom layer to use Smudge tol to modify oralter the image.
15. Use Text tool to create title for drawing and descriptive text.
16. Export image, save and close view.

Here is an example of the end result:

https://www.cloudynights.com/topic/61923...rsa-major/

I'm a newbie to GIMP scripting, so any recommendations, guidance or assistance will be appreciated!

Thanks,

Roy in New Mexico

Here is what the original drawing (above) looks like:


Attached Files Thumbnail(s)
   
Reply
#2
GIMP Processing:

1. Open scanned drawing in GIMP.
2. Invert black and white.
3. Select circle for field of view. Select how... this could be natural to you but there is nothing in Gimp to "see" a circle. So you would have to do that manually. You can possibly start the script once you have created that selection, and do the color inversion at the very end...
4. Invert circle selection.
5. Use Color Picker tool to determine color of background around selected circle. You can use thehistogram function ot have the average color in the selection, which should be fairly close
6. Use Paint Bucket tool to cover background with selected color.
7. Export modified image and save. What is the point of this in a script?
8. Close view. Ditto
9. Re-open image and select "New Layer".
10. Select Paintbrush tool (12 - 20px) to place "stars" over the drawn stars on the bottom layer. Complicated... something that could work (no promises) is a color selection on white. YOU can then transform that selection to a path. The stars will produce strokes that you can consider as small polygons that you can 1) filter on size and 2) compute the centroid
11. Return to bottom layer.
12. Use Color Picker tool to select color of field-of-view background. See 5), with te inverted selection, but you can also possibly use the color you determined in 5), there is not reason why they should be different.
13. Use Paintbrush tool, at 20px size, to paint over stars on bottom layer. You can use the path above (keeping only the strokes you have identified as stars), get a selection from it, grow the selection and bucket fill it.
14. Choice: Return to top layer and use various paintbrush tools to modify or enhance the object (galaxy, star cluster, etc.) OR remain on the bottom layer to use Smudge tol to modify oralter the image. A very manual step...
15. Use Text tool to create title for drawing and descriptive text. Ditto
16. Export image, save and close view.

Efficient scripts are rarely a direct adaptation of what you would do manually.
Reply
#3
Thanks, Ofnuts. This is the kind of "guidance" I need. (If I can reduce the number of manual steps by half, that will be a relief.)

My scanner is an HP PHotosmart, so I'll check the HP site for some way I can script that process, too.

Roy

Reply


Forum Jump: