2

For my research work i have to analyze some thousands of photos, manually it will take more time and human power but thanks to fiji I can easily carryout the analysis but for that the images should be in proper format and order. so i have to edit (cropping the image to the microscopic field and change the background to white) the batch of photospollen study. so how can i automate this for remaining thousands of photos in GIMP.

2
  • 1
    Why in Gimp? Can probably be done faster with ImageMagick in a shell script.
    – xenoid
    Commented May 24 at 7:54
  • can it automatically identify and crop the image to microscopic field?
    – 3ncryp70
    Commented May 24 at 10:18

1 Answer 1

2

With ImageMagick:

Preliminary notice, the black background is far from being uniformly back so either you make it all black (changing the black point with -levels (that also changes the blackpoint in the microscope field and makes the image a bit darker) or you use a very large -fuzz factor for the flood-fill.

In both cases we change the background to white before trimming, because before trimming all the background is connected and is easy to flood-fill, while after the trim it becomes four isolated corners.

With black point:

convert Source.jpg -level 15%,100% -fill white -fuzz 8% -floodfill +0+0 black -trim Trimmed.jpg

Trimmed with black point

Without black point:

convert Source.jpg -fill white -fuzz 20% -floodfill +0+0 black -trim Trimmed.jpg

Trimmed without black point

(using IMv6, if you use a more recent version, replace convert by magick or magick convert. There is also a mogrify command/verb that updates the image in place, when you are confident enough (or have backups).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.