-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add PSD export example #239
Conversation
layers to PSD file format
@lamdalili I can see that the original code (in your repo) is GPL licensed. Graphics32 uses the MPL 1.1 or LGPL 2.1 licenses. |
Fixed various range check and overflow errors. Refs #239
I wrote it with the default configuration, if range checking is enabled, errors may occur.
I think this due to the zip compression which isn't supported by all editors,
yes, no problem for that. |
I found some range erreurs :
Also the call to |
More strict type declarations; Fixed remaining range check errors. Added UI for selection of compression. Refs #239
Yes, I suspected that much but I think there's more to it. While this one handles ZIP but not ZIPrd and complains about an invalid signature with all compressions: https://www.photopea.com/ The PSD reader in GraphicEx refuses to load anything regardless of compression. I have previously used it to load PSD so I know it works. Anyhow, I believe I have now resolved all the issues regarding range check errors. |
It was a bug in GraphicEx; It didn't take alignment padding between adjustment layers (e.g. Unicode layer name) into account. Now it works: I can see that the GraphicEx PSD reader only supports RAW and RLE compression, so it will need some minor work to be able to support full round-tripping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell we're ready to merge.
Great ,I see a lot of progress in the project and a lot of bugs been fixed,
Actuelly they use the same function, the code for the compression operation was improvised and needs to be rebuilt. |
Ah! So it probably does handle ZIPrd but we're not supplying the correct data. |
Yes, i dont no idea what's the difference and how it should be implmented. Can you laod the image in the example as first layer this makes test more random instead of those monolitic shapes with few colors. |
Okay, no problem. It can wait for later. This is a great start regardless. I had a quick look at how it's done in ImageMagick but I don't really have time to do anything with it right now. I also think it has low priority compared to also being able to read PSD files. |
Another problem, image "or what we call background here" for most editors supports only the RLE compression, that's why I set it permanently in the code, L738, for now
The last commit for loading static jpg doesn't work I 've error "file not found" or some thing like; currently the build output folder isn't configured, and the build is at the same level of poject. |
Yes, I noticed that. I think it's sensible to have RLE as the default, but since it's possible to specify another compression we really should respect that and use the compression specified. Anyway, I have begun work on moving your PSD-writer into an image format adapter. I will push some code (into a new branch) for it later today.
That's strange. It should be correctly configured. This is what I'm seeing: What version of Delphi are you using? |
Ah! I've forgotten to push the project settings file. I'll get that committed now. |
Thanks it works now. |
Maybe, but for Photopea, the problem persists if you append the name by one character, an error message occurs, the problem is when you have two variable aligned sections, you don't know at which one the error happened, by adding null character you just aligned ExtraSection by 4 (the spec accepts alignment by 2 but applications use alignment by 4 ) ) This value should be updated to 4
|
Please create a pull request and I'll merge it. |
I'm still seeing the same Photopea warning with ZIP-compressed PSDs. |
Yes I see the error before and I try to understand it, the error happens when Photopea tries to read Layer Glabal Mask which is located just after the LayerInfo section containing the image data, The LayerInfo section is aligned to 2 as shown in the spec, but again needs to be moved to 4 as in the previous case.
spec:
|
Okay. I'm trying that out now... Yes, that did the trick. I'll commit the change. While comparing the spec to the implementation I noticed this in the description of the Channel image data:
I can't see that we're doing that. |
I'm not sure understand all, if talking about each channel separately this might cause problem for decoders, otherwise all other sections at this scope are aligned and any misaligned image data will be corrected, if you know how to handle it you can update the code. |
The code needs to be cleaned up a bit before it can be merged.
I'm also getting the occasional range check error or overflow error when saving PSD.
Initial tests show that some applications have problems reading the generated PSD while others read it fine. This could very well be a problem with the readers and not in the generated files.