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

index out of bounds #57

Open
Smooth-Zhao opened this issue Apr 18, 2024 · 1 comment
Open

index out of bounds #57

Smooth-Zhao opened this issue Apr 18, 2024 · 1 comment

Comments

@Smooth-Zhao
Copy link

Hi,
I'm trying to convert my PSD image to PNG, and when using psd.rgba()
I always get the same error

thread 'tokio-runtime-worker' panicked at xxx\psd-0.3.5\src\psd_channel.rs:130:29:
index out of bounds: the len is 96641024 but the index is 96641025

96641024 looks like a maximum value.
I tried a few other files and it seems the size cannot exceed a certain value, looking at my image size in Photoshop it is 6016*4016.

Here is my code:

let psd = Psd::from_bytes(std::fs::read(path).unwrap().as_bytes()).unwrap();
metadata.image_width = psd.width();
metadata.image_height = psd.height();
println!("{}*{}",metadata.image_width,metadata.image_height);

let final_image = psd.rgba();

what should I do :)

@Smooth-Zhao
Copy link
Author

I cloned the source code, and the problem seems to be that when converting 16-bit color to 8-bit color, only the Red channel is converted. What is the reason for doing this.

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