Closed estellad closed 9 months ago
hi @estellad, do you use a specific function from the OpenImageR package? Can you include a reproducible example for the issue related to the screenshot that you mention?
It seems you might have come to a solution. I'll close the issue for now, feel free to re-open it.
I have caught the same issue:
1. Make a screenshot in Windows, for example:
2. Save it as png
3. Read the image. It appears that it has 4 color channels instead of 3.
> im <- OpenImageR::readImage(image_png)
> dim(im)
[1] 295 902 4
4. It causes an error at resize
> im_new <- OpenImageR::resizeImage(image = im, width = 400, height = 200, normalize_pixels = TRUE)
Error in OpenImageR::resizeImage(image = im, width = 400, height = 200, :
invalid type of image, use either a matrix, data frame or array
My workaround is to remove the 4th channel before resizing, which is responsible for the alpha value (transparency).
im <- im[,,1:3]
im_new <- OpenImageR::resizeImage(image = im, width = 400, height = 200, normalize_pixels = TRUE)
the current error message does not inform about the 4th dimension
invalid type of image, use either a matrix, data frame or array
so the user manually has to keep the first 3 as @DzimitryM did
Hi there,
Thank you for making the package! It looks very promising for so many things! I am using it, and I noticed that any screenshot would have an extra number in the third dimension of a RGB image. Instead of XY3, screenshots always have XY4. Do you think a function could make such conversion, from screenshot to RGB?
Thank you! Estella