Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions py5_docs/Reference/api_en/Py5Image_resize.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@@ meta
name = resize()
type = method
pclass = PImage
processing_name = resize

@@ signatures
resize(w: int, h: int, /) -> None
resize(w: int, h: int, interpolation_mode: int, /) -> None

@@ variables
h: int - height to size image to
interpolation_mode: int - interpolation method for resize operation
w: int - width to size image to

@@ description
Resize the Py5Image object to a new height and width. This will modify the Py5Image object in place, meaning that rather than returning a resized copy, it will modify your existing Py5Image object. If this isn't what you want, pair this method with [](py5image_copy), as shown in the example.

To make the image scale proportionally, use 0 as the value for either the `w` or `h` parameter.

The default resize interpolation mode is `BILINEAR`. Alternatively you can use the `interpolation_mode` parameter to interpolate using the `NEAREST_NEIGHBOR` method, which is faster but yields lower quality results. You can also use `BICUBIC` interpolation, which is the most computationally intensive but looks the best, particularly for up-scaling operations.

@@ example
image = Py5Image_resize_0.png

def setup():
py5.rect(10, 10, 80, 80)
py5.fill(255, 0, 0)
py5.rect(15, 15, 10, 60)
img = py5.get_pixels()
for x in [80, 60, 40]:
img_copy = img.copy()
img_copy.resize(x, 0, py5.BICUBIC)
py5.image(img_copy, 100 - x, 100 - x)
3 changes: 2 additions & 1 deletion py5_docs/Reference/api_en/valid_link_cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,5 +515,6 @@
"https://processing.org/reference/windowX.html": false,
"https://processing.org/reference/windowY.html": false,
"https://processing.org/reference/year_.html": true,
"https://processing.org/reference/PGraphics_is3D_.html": false
"https://processing.org/reference/PGraphics_is3D_.html": false,
"https://processing.org/reference/PImage_resize_.html": true
}
2 changes: 1 addition & 1 deletion py5_resources/data/pimage.csv
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ init,init,,method,SKIP,
save,save,,method,PYTHON,implemented in pixels.py mixin
copy,copy,@_return_py5image,method,JAVA,
mask,mask,,method,JAVA,
resize,resize,,method,SKIP,
resize,resize,,method,JAVA,
get_image,getImage,,method,SKIP,
get_native,getNative,,method,SKIP,
native,native,,unknown,SKIP,
Expand Down