Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch export all opened images in GIMP at once V3.22343567
#10
(01-29-2024, 08:50 AM)Ofnuts Wrote:
(01-29-2024, 05:27 AM)PixLab Wrote: I asked with a script because It's to eventually update that scm to clean all those images up before exporting all, for what happened to Krikor does not happen  Big Grin

Bad idea IMHO. Deleting stuff is always dangerous.  You may solve Krikor's problem, but this puts the images of everybody else in Jeopardy. Lingering images are more general problem. If Krikor has lingering images, then he should complain to the author of the plugin that generates them, or clean them by hand, or clean them with an ad-hoc script, or stop using buggy plugins.

The best you can do is to refuse to run with a message if you find more images than displays. Possible technique:
  • List all images, and count them
  • Obtain their IDs, and find the maximum ID. This gives you a count of all images that have been opened in that Gimp session. Since both image IDs and display IDs are allocated in sequence the max display ID isn't very far from the max Image ID.
  • Iterate all numbers to the max Image ID, plus some margin, say, 20, and count those for which (gimp-display-is-valid display) is true. This gives you the number of active displays
  • If you have more image than displays, bail out.
  • Of course there may be rare cases of people using several displays on one image, and this would mask display less images, but missing that makes you export a couple of extra images, not delete things by mistake.

Deleting stuff is always dangerous, Wow.. this sentence wakes me up, indeed you're absolutely right, I cannot even imagine what people did before using that script, thus it could mess something.
I'm gonna look in the bailout solution you are speaking about as an exercise (but not today  Big Grin ).

And again thanks a LOT for those excellent advises, and possible solutions [Image: thumbsup.png]
Patrice
Reply


Messages In This Thread
RE: Batch export all opened images in GIMP at once V3.22343567 - by PixLab - 01-29-2024, 10:14 AM

Forum Jump: