How to resize selected part of uv image in python? I'm trying to select a part of my uv image. Like this:



At blender, everything looks well.



BUT I need to do this at .py archive. How you can see, Blender "says" that it using bpy.ops.transform.resize(...) to do this.

Using the script that Blender suggests, however, another thing happens!



How I could do, at python, the resizing showed at second image?

My script untill now:

def create_score():
#adding empty object
bpy.ops.object.empty_add()
empty_obj = bpy.context.object
empty_obj.name = "score"

#adding score plane
bpy.ops.mesh.primitive_plane_add(radius=1, location=(0.5,6.7,0))
bpy.ops.transform.resize(value=(-8, -8, -8), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)

#adding score object1
bpy.ops.mesh.primitive_plane_add(radius=0.5, location=(-6, 7.2, 0.1))
obtext1 = bpy.context.object
obtext1.name = "Score1"
obtext1.select = True
bpy.ops.object.editmode_toggle()
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        area.spaces[0].viewport_shade = 'TEXTURED'
        area.type = 'IMAGE_EDITOR'
bpy.ops.image.open(filepath="//../../textures/arialbd.tga", directory="/home/camila/Documents/cinemaxd/PlayerXD/textures/", files=[{"name":"arialbd.tga", "name":"arialbd.tga"}], relative_path=True)
bpy.data.screens['UV Editing'].areas[1].spaces[0].image = bpy.data.images['arialbd.tga']
bpy.ops.uv.unwrap()
bpy.ops.uv.select_all(action='TOGGLE')


This

# store original area type
originalArea = bpy.context.area.type
# change current area to image editor
bpy.context.area.type = 'IMAGE_EDITOR'

#insert UV specific transforms here

#return to previouswindow for good measure ( and cleanliness )
bpy.context.area.type =originalArea


Do not helped too :/
At last, i've found an answer:

#edit the object
bpy.ops.transform.resize(value=(0.1, 0.1, 0.1))
#edit the image's selected part size
bpy.ops.uv.smart_project(island_margin=0.4)
#come object to first status
bpy.ops.transform.resize(value=(10, 10, 10))


I know, it's a kludge. But it's a pretty kludge, and works! :)

Thanks everybody.