# Pixel Coordinates of Rendered Image with Python

I need to get Pixel coordinates of a rendered image.
Here is explanation:

In the Image Editor, I can see the coordinates in the bottom left corner by right clicking in the image. Is it possible to get the coordinates with Python? I need them to setup many crop nodes.

• I want to the almost same thing: get the image pixel coordinate in image editor, is there a simple way to do this? – Joey May 11 '16 at 6:07
• You want to get the pixel coordinates of the image at the mouse cursor's location? – TLousky May 11 '16 at 6:52
• This question should state what the input is exactly that you need to convert into coordinates. – ideasman42 May 11 '16 at 11:34

It seems I found the way how to get pixel coordinates through Rendering Crop. Select a Crop Node and use the script.

import bpy

scene = bpy.context.scene
nodes = scene.node_tree.nodes
cropNode = nodes.active

if cropNode.type == 'CROP':
nodes.active.min_x = scene.render.border_min_x * scene.render.resolution_x
nodes.active.max_x = scene.render.border_max_x * scene.render.resolution_x
nodes.active.min_y = scene.render.border_min_y * scene.render.resolution_y
nodes.active.max_y = scene.render.border_max_y * scene.render.resolution_y