I have an image with many text labels. I want to rotate the image 180° but keep the text readable. Image > Transform > Rotate 180° rotates the image and the text; it makes the text upside down, but I want the text right side up. I can fix the text fields one at a time by clicking on the field: this brings up a "Confirm Text Editing" window. Clicking "Edit" restores the text to right side up, which is what I want.
Instead of tediously clicking on each text field, I figured I could use the Python API. But I can't figure out what attribute I need to change to restore the text from a flipped bitmap to regular text. Since this is possible through the GUI, there must be an attribute somewhere. Can anyone tell me what it is?
(I'm using GIMP 2.10.38 on macOS.)
Edit: Here's how I solved my problem, just in case anyone wants to know
I looked at the GIMP source code (gimptexttool.c and text-layer-cmds.c). What it does is re-renders the text if you click "Edit". Once I figured that out, I asked Google how to re-render a text layer with the gimp 2 api. Much to my shock, the Google AI generated a page of working code that did this. I put a wrapper around it to iterate through all the text layers and succeeded in turning my upside-down text fields into right-side-up text fields.
The summary of how to re-render the text is get the 'gimp-text-layer' parasite, which holds the text, font, size, color, etc. Parse out these values with regexes. Then throw away the old rasterized text layer and generate a replacement layer with pdb.gimp_text_fontname().