Processing.py-Bugs icon indicating copy to clipboard operation
Processing.py-Bugs copied to clipboard

Issue with tutorial in "Images and Pixels : Example: Displaying the Pixels of an Image" for Processing PY

Open kaioliver0 opened this issue 4 years ago • 3 comments

I recently came across an error in the Processing.Py tutorial code. When trying to follow along with the example "displaying the pixels of an image", I kept getting the error "AttributeError: "NoneType' object has no attribute 'loadPixels'.

I thought that this was due to my own error but I copy and pasted the text code directly and got the same message- is it possible this is due to an update with Processing that came out after the tutorial was posted?

kaioliver0 avatar Feb 10 '22 03:02 kaioliver0

The examples "Brightness Threshold" and "Pointillism" have a similar issue- an error comes up saying "AttributeError:'NoneType object has no attribute 'width'".

There are also issues with the example "Sharpen with Convolution" with the error "NullPointerException at processing.core.PGraphics.image(PGraphics.java:3814)atprocessing.core.PApplet.image"

Finally, for the example "2D image mapped to 3D", there is an error "AttributeError: 'NoneType' object has no attribute 'pixels'".

kaioliver0 avatar Feb 10 '22 03:02 kaioliver0

I assume you're referring to this documentation? https://py.processing.org/tutorials/pixels/

"AttributeError: "NoneType' object has no attribute 'loadPixels'.

The "Example: Displaying the pixels of an image" code seems to work fine for me. You must be missing a sunflower.jpg image? Find/prepare some 200 × 200-pixel image (of anything really), name it sunflower.jpg and place that file in your sketch folder (alongside the .pyde file).

tabreturn avatar Feb 10 '22 06:02 tabreturn

Yes, my apologies for not linking the documentation. I tried to use the code for a different image of the same size and changed the code accordingly. I also dragged the file of the picture I was using into Processing but always get the same error. I am able to load and display images fine but the issues come in when I attempt to edit them. It is good to know it is working for others, I am wondering if maybe it is particular to my computer.

EDIT: I am able to sucessfully follow the tutorials for editing opacity and tint.

kaioliver0 avatar Feb 10 '22 18:02 kaioliver0