I found an error in the imaging documentation page

Playing around with Imaging API, I found this dispose() method which frees memory after using the .getData() method. However here’s the issue I found:

Here’s the link to the documentation error:

If you try to run the same code in the example:

const pixelData = await imageObj.imageData.getData();
// This will return an error: "pixelData.dispose is not a function"

Which is obvious as the getData() method returns an array of numbers (image pixel data) and not an object, so the object is the imageObj.ImageData and this can call the dispose() function indeed to free the memory from the imageObj.imageData.getData();

How I know this?

I tried to do the imageObj.imageData.dispose() method after storing the data obtained with the imageObj.imageData.getData() it into a constant and it worked.

So I think this should be changed to
Instead of

So this is something that can be confusing for future developers reading the documentation.

Hope it gets clear enough.

Correct if I’m wrong, please.

1 Like

Try reporting issue on GitHub. And I believe this is the page you’re refering to.

BTW, years ago I tried to contribute there, but their some agreement signing process is was a blocker, so I didn’t bother any more. Maybe they changed that policy. It’s insane to request to sign some agreement for public repo

Ah, you mean this bit:
Screenshot 2024-03-26 at 3.59.57 PM

Which links here to the Open Source CLA … the legal team required that checkbox. I think PRs don’t go through if you don’t check it.

Yes, this must be it (on mobile it won’t allow me to view the page). Sorry, but I’m not signing anything (especially what I don’t understand) to be able to simply suggest the changes, which might be not even accepted :man_shrugging:

Thank you, just posted it on github!

Ah, yes, dispose is a sibling method to getData. I’ll update the source of the documentation.

1 Like