*info;
Image
+ *base_image,
*next_image;
MagickBooleanType
size;
status=MagickTrue;
+ base_image=GetNextImageInList(image);
+ if (base_image == (Image *) NULL)
+ base_image=image;
size=0;
size_offset=TellBlob(image);
SetPSDSize(psd_info,image,0);
layer_count=0;
- for (next_image=image; next_image != NULL; )
+ for (next_image=base_image; next_image != NULL; )
{
layer_count++;
next_image=GetNextImageInList(next_image);
if (layer_size_offsets == (MagickOffsetType *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
layer_index=0;
- for (next_image=image; next_image != NULL; )
+ for (next_image=base_image; next_image != NULL; )
{
Image
*mask;
/*
Now the image data!
*/
- next_image=image;
+ next_image=base_image;
layer_index=0;
while (next_image != NULL)
{
/*
Remove the opacity mask from the registry
*/
- next_image=image;
+ next_image=base_image;
while (next_image != (Image *) NULL)
{
property=GetImageArtifact(next_image,"psd:opacity-mask");
}
if (status != MagickFalse)
{
- Image
- *base_image;
-
MagickOffsetType
size_offset;
size_offset=TellBlob(image);
SetPSDSize(&psd_info,image,0);
- base_image=GetNextImageInList(image);
- if (base_image == (Image *) NULL)
- base_image=image;
- status=WritePSDLayersInternal(base_image,image_info,&psd_info,&size,
+ status=WritePSDLayersInternal(image,image_info,&psd_info,&size,
exception);
size_offset+=WritePSDSize(&psd_info,image,size+
(psd_info.version == 1 ? 8 : 16),size_offset);
*custom_stream;
Image
+ *base_image,
*next;
ImageInfo
StringInfo
*layers;
- next=image->next;
- if (next == (Image *) NULL)
+ base_image=CloneImage(image,0,0,MagickFalse,exception);
+ if (base_image == (Image *) NULL)
return(MagickTrue);
clone_info=CloneImageInfo(image_info);
if (clone_info == (ImageInfo *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
- DestroyBlob(next);
- next->blob=blob;
+ DestroyBlob(base_image);
+ base_image->blob=blob;
+ next=base_image;
while (next != (Image *) NULL)
next=SyncNextImageInList(next);
- next=image->next;
- AttachCustomStream(next->blob,custom_stream);
+ AttachCustomStream(base_image->blob,custom_stream);
InitPSDInfo(image,&info);
- if (next->endian == UndefinedEndian)
- next->endian=(HOST_FILLORDER == FILLORDER_LSB2MSB) ? LSBEndian : MSBEndian;
+ if (base_image->endian == UndefinedEndian)
+ base_image->endian=(HOST_FILLORDER == FILLORDER_LSB2MSB) ? LSBEndian : MSBEndian;
WriteBlobString(next,"Adobe Photoshop Document Data Block");
- WriteBlobByte(next,0);
- WriteBlobString(next,next->endian == LSBEndian ? "MIB8ryaL" : "8BIMLayr");
- status=WritePSDLayers(next,clone_info,&info,exception);
+ WriteBlobByte(base_image,0);
+ WriteBlobString(base_image,base_image->endian == LSBEndian ? "MIB8ryaL" : "8BIMLayr");
+ status=WritePSDLayers(base_image,clone_info,&info,exception);
if (status != MagickFalse)
{
SetStringInfoLength(layers,(size_t) profile.offset);
status=SetImageProfile(image,"tiff:37724",layers,exception);
}
+ next=base_image;
while (next != (Image *) NULL)
{
CloseBlob(next);