How to use tifffile and psdtags to create multi-channel tiff files

207 Views Asked by At

I have two tif files, one of which is a CMYKA channel file, and the other is a single channel file [w1]. I want to merge the w1 channel file into the CMYKA file, but I don't know how to use tifffile and psdtags to generate a new CMYKAw1 channel file

I've tried doing this, but it doesn't seem to work

isd = TiffImageSourceData.frombytes(b'Adobe Photoshop Document Data Block\0')

res = TiffImageResources.frombytes(bytes())
res.name = 'temp.tif'
res.psdformat = PsdFormat.BE32BIT

res.blocks.append(
    PsdVersionBlock(PsdResourceId.VERSION_INFO,
                    1,1,'Adobe Photoshop',
                    'Adobe Photoshop 2020',True))
res.blocks.append(
    PsdPascalStringsBlock(PsdResourceId.ALPHA_NAMES_PASCAL,
                    values=["alpha","w1"]))
res.blocks.append(
    PsdPascalStringsBlock(PsdResourceId.ALPHA_NAMES_UNICODE,
                    values=["alpha","w1"]))
0

There are 0 best solutions below