Write 32 bit per channel layered PSD files #6729
Replies: 4 comments
-
As you surmised, ImageMagick does not support 32-bit HDRI Photoshop images. Any user can post a pull request to address this deficiency. Otherwise the community must wait until one of the ImageMagick developers finds the time to improve the PSD coder. We currently do not have an ETA to address this feature request. |
Beta Was this translation helpful? Give feedback.
-
If it's of interest I've managed to compile a version which does produce functioning 32-bit HDRI PSD files and can support my intended goal of composing several EXR files into a PSD file. There is a (undocumented as far as file format specifications available online go) 112 byte block of data in the color mode data section which is required. Unfortunately due to the lack of documentation I'm unsure what this data represents. It does not change as far as tests have yielded, regardless of color mode/resolution/color profile/layers. Currently I'm working around this by recreating this data block in 32-bit files. I can provide the working psd.c here, so if an ImageMagick dev wants to take a look for further info please let me know, but as this isn't an exhaustive solution which documents what the data contains, I won't create a pull request for this :). |
Beta Was this translation helpful? Give feedback.
-
Feel free to share a |
Beta Was this translation helpful? Give feedback.
-
Cannot upload .patch extension file so just zipped it here. Please do let me know if you find some meaningful information on what this 112 byte data block is as I'd love to make sure its documented somewhere (and in turn create a more sophisticated fix), since Adobe's file format spec online doesn't have this info. The data block starts with the characters 'HDR' and it was like a realisation slap in the face when I spotted the difference there between self written 32 bit files and Photoshop files 😂 |
Beta Was this translation helpful? Give feedback.
-
Prerequisites
Description
Currently it seems IM will only write 8 bit or 16 bit PSD files. The functionality is not broken but rather missing, whereas 32-bit PSD read capability looks to have been added.
Steps to Reproduce
Using any configuration of IM creating a 32 bit PSD is unachievable. I am specifically aiming to create 32-bit layered PSD files from several EXR files, used as the layers. I can create this in 16-bit format but as Photoshop's 16 bit format is integer mode data is lost and the operations I intend to perform cannot be performed without 32-bit mode.
I have attached an example EXR which holds a single red pixel which can be used to test converison to 32 bit PSD. This can be converted to 8bit PSD or 16bit PSD currently by IM and works but will lose data when doing this. Same principle would apply if I were taking HDR/TIFF/etc images to use as layers.
singlered.zip
Removing the 16 bit overrides in psd.c to write 32 bit mode to the PSD file header and override within the data writing functions works to produce a file detected as 32 bit, however the result of data written in WritePSDChannel() does not produce a valid file. As a test I am using memset to write blank pixels before the channel row data is written in WriteBlob, and performing this with no compression so handling raw data. The data written is still invalid if quantum_info->format is additionally specified as floating-point (I thought this could maybe be why the channel data was invalid.) I am unsure what additionally could be wrong in this test but hoping someone more knowledgeable with IM or the PSD format in 32-bit can help.
System Configuration
I have compiled latest version IM Q32 HDRI, testing this both using command line and Magick++ as part of a dll.
Beta Was this translation helpful? Give feedback.
All reactions