Skip to content
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

I found an error in the imaging documentation page #463

Open
molvera3 opened this issue Mar 27, 2024 · 0 comments
Open

I found an error in the imaging documentation page #463

molvera3 opened this issue Mar 27, 2024 · 0 comments

Comments

@molvera3
Copy link

Repo file: /src/pages/ps_reference/media/imaging.md
Live page link (and page section): https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/imaging/#dispose
Issue description:
"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:
https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/imaging/#dispose 1

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

const pixelData = await imageObj.imageData.getData();
pixelData.dispose();
// 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();

image

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
imageObj.imageData.dispose();
Instead of
pixelData.dispose();

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."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant