-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add width, height support to put_image_data #304
Comments
martinRenou
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Nov 29, 2022
ipycanvas tries to stay close to the web canvas API, and this is not a feature that this API provides: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData Though you can actually work around this by having another Canvas: from ipycanvas import Canvas
import numpy as np
canvas1 = Canvas(width=200, height=200)
canvas1.put_image_data(np.random.uniform(size=(200,200,3)))
canvas2 = Canvas(width=300, height=300)
# Draw canvas1 on canvas2 and scale it down to (100, 100)
canvas2.draw_image(canvas1, 0, 0, 100, 100)
canvas2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
As far as I can see, there is no way to scale an image when using
put_image_data
.e.g.:
No matter the width and height of the canvas... Which is different from
draw_image
where there are two other variables(width, height)
which scale the image, is it possible to add this feature?The text was updated successfully, but these errors were encountered: