Open gregl83 opened 2 years ago
Thanks for reporting this issue!
So it looks like right now when generating the RGBA bytes vector we always use the psd's width and height https://github.com/chinedufn/psd/blob/930d00117fa9d625ebb1f006066437ec3156d2f2/src/psd_channel.rs#L33
Here's a rough guide on how to fix this:
Add a test to https://github.com/chinedufn/psd/blob/930d00117fa9d625ebb1f006066437ec3156d2f2/tests/layer_and_mask_information_section.rs#L18 .. perhaps called layer_larger_than_psd
, where we try to get the .rgba()
of a 2x2 layer that is inside of a 1x1 PSD file. Would want to add this new test PSD file to the test fixtures directory https://github.com/chinedufn/psd/tree/c434d36b4e1d00a0ca14e9b39d6e7fcbdd6127ff/tests/fixtures . Test should fail.
Rename the psd_width
and psd_height
methods to pixel_width
and pixel_height
Replace self.layer_properties.psd_width
with self.layer_properties.width()
. Same idea for the height. Test should now pass. https://github.com/chinedufn/psd/blob/930d00117fa9d625ebb1f006066437ec3156d2f2/src/sections/layer_and_mask_information_section/layer.rs#L457-L463
Hi!
Encountering a bug when attempting to load the pixels of each layer in a PSD.
Snippet
Error
Untested Presumption Layer size can be larger than a PSD project size (dimensions) resulting in overflowed pixels in the PSD overflowing the rgba pixel vector.