-
Notifications
You must be signed in to change notification settings - Fork 41
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
Writing down PSD files #1
Comments
Thanks for opening this issue! So, I'm assuming that you want to export to an image format so that modders can use a regular old image editor to mod levels? So, there are 4 bytes of data per tile if I'm understanding correctly. Would it be alright to store them in RGBA in a single layer (with the alpha channel holding the two half-byte channels)? Or would it be better to have 5 layers, one layer per channel? This is more of a UX question as I'm not sure how people intend to mod levels and what would make the most sense visually. (5 layers would be bigger since there would be extra channels for each layer, but they'd be compressed so would need to think about / investigate how much of a difference this would make size-of-file wise) Thanks for clarifying! |
As I mentioned, there isn't many image editors supporting multiple layers. If the users are able to use Photoshop, that's already a win for us.
No, we already have that in other formats. It's very inconvenient for the users to than decode those 4-bit channels.
Yes. Preferably, in fixed order and/or named. |
Thanks! Alright - to make sure that I fully understand the use case - would the following rough sketch meet your needs? use psd::{Psd, PsdLayer};
fn main () {
let mut psd = Psd::new(16000, 2000); // width, height
let channel_1 = vec![0; 16000 * 2000];
let channel_2 = vec![0; 16000 * 2000];
// ... same for all 5 channels ...
let mut layer_1 = PsdLayer::new("First Channel");
layer_1.set_red(channel_1);
let mut layer_2 = PsdLayer::new("Second Channel");
layer_2.set_red(channel_2);
// ... same for all 5 channels ...
let mut psd_file: Vec<u8> = vec![];
psd.write(&mut psd_file);
} Then you'd end up with a PSD with 5 gray layers (layers with only one channel show up as gray in Photoshop). Well in this specific example they'd be black ... but I mean in a real use case .. EDIT - I did some experimenting and a PSD is grey when the color type of the psd is grayscale. A grayscale image can have 2 channels if it's 16bit. |
Yeah, that would likely work for us 👍 |
Awesome! I'll take some stabs here next time I'm working on Thanks for explaining! |
In https://github.com/kvark/vange-rs project, we faced an unexpected problem. We wanted to export the level data for modders to play with, and then import back. The data of the level is somewhat strange:
Apparently, there is no existing open format to support that. We tried TIFF and faced the lack of proper support on both GIMP and Photoshop sides. It would be very convenient if we could export/import a PSD (without losing the data) for this - at least Photoshop would be guaranteed to work.
The text was updated successfully, but these errors were encountered: