chinedufn / psd

A Rust API for parsing and working with PSD files.
https://chinedufn.github.io/psd
Apache License 2.0
261 stars 35 forks source link

Layers outside of the bounding rect of the PSD #43

Open bram-dingelstad opened 1 year ago

bram-dingelstad commented 1 year ago

I am trying to render PSD layers to seperate PNG files for a game. Our artists sometimes give us PSDs with layers that are slightly outside of the bounding box, as to make the final composition work. However, I would assume I can still extract the full image information.

This issue is likely related to or a duplicate of #26

Let me know if the general fix for this is similar as you outlined in #26 @chinedufn & i'll get to it!

When exporting the layers I get the following error:

thread 'main' panicked at 'attempt to multiply with overflow', /Users/bram/Development/psd/src/sections/layer_and_mask_information_section/layer.rs:438:9

or

thread 'main' panicked at 'index out of bounds: the len is 40212480 but the index is 40213160', /Users/bram/Development/psd/src/psd_channel.rs:171:21
namse commented 1 year ago

I face same issue, this library change i32 to usize without any protection. https://github.com/chinedufn/psd/blob/5276ab762addfc6eeb711cbb35cbb7c12a472a2d/src/sections/layer_and_mask_information_section/layer.rs#L436

image

chinedufn commented 1 year ago

This issue is likely related to or a duplicate of https://github.com/chinedufn/psd/issues/26

@bram-dingelstad not sure if you found a different solution, but if not I'd be happy to review a fix to #26 . From what I'm understanding it sounds related to your issue.