How to resize image in Python?

2 hours I’m try to resize image with Python.
No one example found on the web and here - on forum.
I try with all variants to resize image with python. No working.
Reason - I don’t known how to use methods which resize image.

I tried this variants.

resize = app.createNode("fr.inria.openfx.OIIOResize", -1, app, dict([("CreateNodeArgsPropNodeInitialName", NatronEngine.StringNodeCreationProperty("Resize"))]))
app.Resize.type.set("Size")
app.Resize.preservePAR.set(False)

Not work 
app.Resize.size.x = 300

Not work 
 app.Resize.size.x.set(300)

Not work 
app.Resize.size.set(300, 300)


Not work 
app.Resize.size.set(300)

Not work 
app.Resize.size = (300, 300)

And any combinations. Not work.

You guys don’t know how to write documentation. Please don’t do this. It doesn’t help people.

In c++ I know how to use any method and any parameter. Here, in Python - I don’t know how to use it.

If you’re going to ask for help, its best not to be insulting. Please be kind.

3 Likes

This works, as described in the documentation.

In some cases it work incorrect. Changed only X component. Bu it happened in Project Created Callback. If I change size in Menu Command Handler - it work always.

Documentation.
Need more and more examples of code usage.

The documentation (and Natron in general) is a community effort. This means people usually only contribute/work on things they care about, or want to improve. Feel free to help us improve the documentation, see Update/Complete the Documentation.

3 Likes