-
Notifications
You must be signed in to change notification settings - Fork 120
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
Basic PSD decoding support #233
Conversation
Hey, I'm sorry I've been busy for awhile. I'm going to merge in the older PRs in two weeks. And then cut a release since there's been a lot of new and changed features |
@sylikc you should upgrade libjxl to a newer commit before you make the new release. 0.8.2 doesn't have the fix for libjxl/libjxl#2251, so right now all HDR images appear too dark. |
Is this already fixed in libjxl? |
@Hrxn looks like it |
I'm back (life has been especially busy). I pulled in the updated libs, but the libjxl issue is still open. I'm thinking about cutting a release now, there's like tons of changes i've made in the past few months, mostly related to translations, but I really wanted to get the raw stuff in. |
@sylikc the version of libjxl you pulled in already has the fix. |
@qbnu should I merge this in now or are you still doing some work on it? |
@sylikc You can merge it. I want to improve it eventually but it works well enough for now. "Date Time" might not be the best name to use. According to the EXIF spec it's usually used to refer to the last time the file was changed, but I couldn't think of a good name that wouldn't be confused with the filesystem's modification date. If you can think of something better you should change it. Maybe "Last edited date" or "Last edited on"? |
I was just looking at that... in ExifTool I think it's just DateTime, but in JPEGView probably hmm... the spec says it's usually the same as DateTimeOriginal, but it's not guaranteed. We could just use something like "Exif Modified date:"? When other programs edit and re-save the file, there's no guarantee that that DateTime gets changed... based on your investigation, in Photoshop it looks like it would, but the ExifReader class would read it for all files which may not have been edited? hmm we can revisit this naming later |
Adds support for decoding most common PSDs. If decoding fails, display embedded JPEG. Note: The PSD must have been saved with "Maximize Compatibility" in Photoshop. Otherwise the image data section will not contain the flattened image, in which case we just return the thumbnail. Color Modes: - Bitmap - Unsupported + Grayscale - Supported - Indexed - Unsupported + RGB - Supported ~ CMYK - Supported, but colors will be inaccurate. + Multichannel - Supported + Duotone - Treated as grayscale + Lab - Supported if LCMS is present. Otherwise it's treated as grayscale. Bits: Only 8-bit PSDs are supported. Compression Modes: + Raw/Uncompressed - Supported + RLE (run-length encoding) - Supported. Used in the vast majority of PSDs. - ZIP without prediction - Unsupported - ZIP with prediction - Unsupported Alpha channels: + Only supported for RGB PSDs. ICC Profiles + Only supported for RGB PSDs. EXIF Data + Supported. 2 new fields added: + "Software" (e.g. Adobe Photoshop CS6, GIMP 2.10.34, etc.) + "Date Time" (used by Photoshop to store modification date) PSB (Large Document Format) + Thumbnail only See PR for more all details Merge PR #233 by https://github.com/qbnu
Format documentation: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
Adds support for decoding most common PSDs. If we can't decode them we try to display the embedded JPEG thumbnail instead. The decompression code is from SAIL: https://github.com/HappySeaFox/sail/blob/master/src/sail-codecs/psd/psd.c
Note
The PSD must have been saved with "Maximize Compatibility" in Photoshop. Otherwise the image data section will not contain the flattened image, in which case we just return the thumbnail.
Color Modes
Bitmap - Unsupported
Grayscale - Supported
Indexed - Unsupported
RGB - Supported
CMYK - Supported, but colors will be inaccurate. Similar behavior to IMDisplay.
Multichannel - I don't know what this is, but the two files I could find with it worked.
Duotone - Treated as grayscale, which is what the documentation suggests and the same behavior as ImageMagick and GIMP.
Lab - Supported if LCMS is present. Otherwise it's treated as grayscale.
Bit depths
Only 8-bit PSDs are supported.
Compression Modes
Raw/Uncompressed - I could only find one test file, but it should work.
RLE (run-length encoding) - Supported. Used in the vast majority of PSDs.
ZIP without prediction - Unsupported
ZIP with prediction - Unsupported
Alpha channels
Only supported for RGB PSDs. I couldn't get them to work with Lab.
ICC Profiles
Only supported for RGB PSDs.
EXIF Data
Supported. I added two new fields: "Software" (e.g. Adobe Photoshop CS6, GIMP 2.10.34, etc.) and "Date Time" (used by Photoshop to store modification date).
PSB (Large Document Format)
Thumbnail only
Some useful links
SAIL's PSD implementation:
https://github.com/HappySeaFox/sail/blob/master/src/sail-codecs/psd/psd.c
I looked into using psd_sdk, but I'm not sure how to build it as a DLL.
ImageMagick's implementation might be useful to look at:
https://github.com/ImageMagick/ImageMagick/blob/main/coders/psd.c
Duotone:
https://gitlab.gnome.org/GNOME/gimp/-/issues/19
https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/690
Lab color:
https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/476
https://expertphotography.com/lab-color-photoshop/
Maximize Compatibility/hasRealMergedData:
https://exiftool.org/forum/index.php?topic=12897.0
Detecting whether to use alpha channel:
psd-tools/psd-tools#369
Closes #29 and #228