Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python-Fu · Get viewport position
#1
Question 
Hi everyone.

I'm writing a plugin to automate some processes. I'm sticking to Python because I've had issues with C and Scheme.

Consider an image opened in GIMP with a zoom large enough to cause only part of the image to be seen. So, you can scroll the viewport around to see other parts of the image.

I want to know what code I have to use to know which pixels are visible, so I can add a layer to the image to a position where it will be visible in my current zoom setting.

I'm using GIMP 2.8.20 on Windows 7 Ultimate x64.

Thanks in advance.
Reply
#2
AFAIK you can't. By design the plugins don't know much about what is happening in the UI, and also cannot make any change to it.

Also, in the general case your question has no answer, how do you handle the case where the user has opened several "views"(*) of the same image?

(*) View>New view
Reply
#3
(12-16-2017, 04:49 PM)Ofnuts Wrote: AFAIK you can't. By design the plugins don't know much about what is happening in the UI, and also cannot make any change to it.

Also, in the general case your question has no answer, how do you handle the case where the user has opened several "views"(*) of the same image?

(*) View>New view

That's too bad. I'll have to improvise by making a selection to mark where to add the layer.

Thanks anyway!

Regarding the second point, I'm doing this only for me so I'll never open more than one view.
Reply
#4
(12-16-2017, 05:04 PM)guiritter Wrote:
(12-16-2017, 04:49 PM)Ofnuts Wrote: AFAIK you can't. By design the plugins don't know much about what is happening in the UI, and also cannot make any change to it.

Also, in the general case your question has no answer, how do you handle the case where the user has opened several "views"(*) of the same image?

(*) View>New view

That's too bad. I'll have to improvise by making a selection to mark where to add the layer.

Which is pretty much the right way to do it anyway Smile
Reply


Forum Jump: