Coverage Report

Created: 2026-09-28 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/imagemagick/coders/ept.c
Line
Count
Source
1
/*
2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3
%                                                                             %
4
%                                                                             %
5
%                                                                             %
6
%                            EEEEE  PPPP   TTTTT                              %
7
%                            E      P   P    T                                %
8
%                            EEE    PPPP     T                                %
9
%                            E      P        T                                %
10
%                            EEEEE  P        T                                %
11
%                                                                             %
12
%                                                                             %
13
%           Read/Write Encapsulated Postscript Format (with preview).         %
14
%                                                                             %
15
%                              Software Design                                %
16
%                                   Cristy                                    %
17
%                                 July 1992                                   %
18
%                                                                             %
19
%                                                                             %
20
%  Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization         %
21
%  dedicated to making software imaging solutions freely available.           %
22
%                                                                             %
23
%  You may not use this file except in compliance with the License.  You may  %
24
%  obtain a copy of the License at                                            %
25
%                                                                             %
26
%    https://imagemagick.org/license/                                         %
27
%                                                                             %
28
%  Unless required by applicable law or agreed to in writing, software        %
29
%  distributed under the License is distributed on an "AS IS" BASIS,          %
30
%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
31
%  See the License for the specific language governing permissions and        %
32
%  limitations under the License.                                             %
33
%                                                                             %
34
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35
%
36
%
37
*/
38

39
/*
40
  Include declarations.
41
*/
42
#include "MagickCore/studio.h"
43
#include "MagickCore/blob.h"
44
#include "MagickCore/blob-private.h"
45
#include "MagickCore/color.h"
46
#include "MagickCore/constitute.h"
47
#include "MagickCore/draw.h"
48
#include "MagickCore/exception.h"
49
#include "MagickCore/exception-private.h"
50
#include "MagickCore/delegate.h"
51
#include "MagickCore/geometry.h"
52
#include "MagickCore/histogram.h"
53
#include "MagickCore/image.h"
54
#include "MagickCore/image-private.h"
55
#include "MagickCore/list.h"
56
#include "MagickCore/magick.h"
57
#include "MagickCore/memory_.h"
58
#include "MagickCore/memory-private.h"
59
#include "MagickCore/monitor.h"
60
#include "MagickCore/monitor-private.h"
61
#include "MagickCore/quantize.h"
62
#include "MagickCore/resource_.h"
63
#include "MagickCore/resize.h"
64
#include "MagickCore/quantum-private.h"
65
#include "MagickCore/static.h"
66
#include "MagickCore/string_.h"
67
#include "MagickCore/module.h"
68
#include "MagickCore/utility.h"
69

70
/*
71
  Typedef declarations.
72
*/
73
typedef struct _EPTInfo
74
{
75
  size_t
76
    magick;
77
78
  MagickOffsetType
79
    postscript_offset,
80
    tiff_offset;
81
82
  size_t
83
    postscript_length,
84
    tiff_length;
85
86
  unsigned char
87
    *postscript,
88
    *tiff;
89
} EPTInfo;
90

91
/*
92
  Forward declarations.
93
*/
94
static MagickBooleanType
95
  WriteEPTImage(const ImageInfo *,Image *,ExceptionInfo *);
96

97
/*
98
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99
%                                                                             %
100
%                                                                             %
101
%                                                                             %
102
%   I s E P T                                                                 %
103
%                                                                             %
104
%                                                                             %
105
%                                                                             %
106
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107
%
108
%  IsEPT() returns MagickTrue if the image format type, identified by the
109
%  magick string, is EPT.
110
%
111
%  The format of the IsEPT method is:
112
%
113
%      MagickBooleanType IsEPT(const unsigned char *magick,const size_t length)
114
%
115
%  A description of each parameter follows:
116
%
117
%    o magick: compare image format pattern against these bytes.
118
%
119
%    o length: Specifies the length of the magick string.
120
%
121
*/
122
static MagickBooleanType IsEPT(const unsigned char *magick,const size_t length)
123
0
{
124
0
  if (length < 4)
125
0
    return(MagickFalse);
126
0
  if (memcmp(magick,"\305\320\323\306",4) == 0)
127
0
    return(MagickTrue);
128
0
  return(MagickFalse);
129
0
}
130

131
/*
132
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133
%                                                                             %
134
%                                                                             %
135
%                                                                             %
136
%   R e a d E P T I m a g e                                                   %
137
%                                                                             %
138
%                                                                             %
139
%                                                                             %
140
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141
%
142
%  ReadEPTImage() reads a binary Postscript image file and returns it.  It
143
%  allocates the memory necessary for the new Image structure and returns a
144
%  pointer to the new image.
145
%
146
%  The format of the ReadEPTImage method is:
147
%
148
%      Image *ReadEPTImage(const ImageInfo *image_info,
149
%        ExceptionInfo *exception)
150
%
151
%  A description of each parameter follows:
152
%
153
%    o image_info: the image info.
154
%
155
%    o exception: return any errors or warnings in this structure.
156
%
157
*/
158
static Image *ReadEPTImage(const ImageInfo *image_info,ExceptionInfo *exception)
159
16.4k
{
160
16.4k
  const void
161
16.4k
    *postscript_data,
162
16.4k
    *tiff_data;
163
164
16.4k
  EPTInfo
165
16.4k
    ept_info;
166
167
16.4k
  Image
168
16.4k
    *image,
169
16.4k
    *tiff_image;
170
171
16.4k
  ImageInfo
172
16.4k
    *read_info;
173
174
16.4k
  MagickBooleanType
175
16.4k
    status;
176
177
16.4k
  MagickOffsetType
178
16.4k
    offset;
179
180
16.4k
  ssize_t
181
16.4k
    count;
182
183
  /*
184
    Open image file.
185
  */
186
16.4k
  assert(image_info != (const ImageInfo *) NULL);
187
16.4k
  assert(image_info->signature == MagickCoreSignature);
188
16.4k
  assert(exception != (ExceptionInfo *) NULL);
189
16.4k
  assert(exception->signature == MagickCoreSignature);
190
16.4k
  if (IsEventLogging() != MagickFalse)
191
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
192
0
      image_info->filename);
193
16.4k
  image=AcquireImage(image_info,exception);
194
16.4k
  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
195
16.4k
  if (status == MagickFalse)
196
0
    {
197
0
      image=DestroyImageList(image);
198
0
      return((Image *) NULL);
199
0
    }
200
16.4k
  ept_info.magick=ReadBlobLSBLong(image);
201
16.4k
  if (ept_info.magick != 0xc6d3d0c5ul)
202
15.9k
    ThrowReaderException(CorruptImageError,"ImproperImageHeader");
203
15.9k
  ept_info.postscript_offset=(MagickOffsetType) ReadBlobLSBLong(image);
204
15.9k
  ept_info.postscript_length=ReadBlobLSBLong(image);
205
15.9k
  if (HeapOverflowCheckAdd(ept_info.postscript_length,1) != MagickFalse)
206
15.9k
    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
207
15.9k
  if ((MagickSizeType) ept_info.postscript_length > GetBlobSize(image))
208
15.8k
    ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
209
15.8k
  (void) ReadBlobLSBLong(image);
210
15.8k
  (void) ReadBlobLSBLong(image);
211
15.8k
  ept_info.tiff_offset=(MagickOffsetType) ReadBlobLSBLong(image);
212
15.8k
  ept_info.tiff_length=ReadBlobLSBLong(image);
213
15.8k
  if (HeapOverflowCheckAdd(ept_info.tiff_length,1) != MagickFalse)
214
15.8k
    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
215
15.8k
  if ((ept_info.postscript_length+ept_info.tiff_length) == 0)
216
15.8k
    ThrowReaderException(CorruptImageError,"ImproperImageHeader");
217
15.8k
  if ((MagickSizeType) ept_info.tiff_length > GetBlobSize(image))
218
15.8k
    ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
219
15.8k
  (void) ReadBlobLSBShort(image);
220
15.8k
  ept_info.postscript=(unsigned char *) AcquireQuantumMemory(
221
15.8k
    ept_info.postscript_length+1,sizeof(*ept_info.postscript));
222
15.8k
  if (ept_info.postscript == (unsigned char *) NULL)
223
15.8k
    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
224
15.8k
  (void) memset(ept_info.postscript,0,(ept_info.postscript_length+1)*
225
15.8k
    sizeof(*ept_info.postscript));
226
15.8k
  ept_info.tiff=(unsigned char *) AcquireQuantumMemory(ept_info.tiff_length+1,
227
15.8k
    sizeof(*ept_info.tiff));
228
15.8k
  if (ept_info.tiff == (unsigned char *) NULL)
229
0
    {
230
0
      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
231
0
        ept_info.postscript);
232
0
      ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
233
0
    }
234
15.8k
  (void) memset(ept_info.tiff,0,(ept_info.tiff_length+1)*
235
15.8k
    sizeof(*ept_info.tiff));
236
15.8k
  offset=SeekBlob(image,ept_info.tiff_offset,SEEK_SET);
237
15.8k
  if ((ept_info.tiff_length != 0) && (offset < 30))
238
13
    {
239
13
      ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
240
13
      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
241
13
        ept_info.postscript);
242
13
      ThrowReaderException(CorruptImageError,"ImproperImageHeader");
243
0
    }
244
15.7k
  tiff_data=ReadBlobStream(image,ept_info.tiff_length,ept_info.tiff,&count);
245
15.7k
  if (count != (ssize_t) (ept_info.tiff_length))
246
13.9k
    (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageWarning,
247
13.9k
      "InsufficientImageDataInFile","`%s'",image->filename);
248
15.7k
  offset=SeekBlob(image,ept_info.postscript_offset,SEEK_SET);
249
15.7k
  if ((ept_info.postscript_length != 0) && (offset < 30))
250
41
    {
251
41
      ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
252
41
      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
253
41
        ept_info.postscript);
254
41
      ThrowReaderException(CorruptImageError,"ImproperImageHeader");
255
0
    }
256
15.7k
  postscript_data=ReadBlobStream(image,ept_info.postscript_length,
257
15.7k
    ept_info.postscript,&count);
258
15.7k
  if (count != (ssize_t) (ept_info.postscript_length))
259
128
    {
260
128
      ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
261
128
      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
262
128
        ept_info.postscript);
263
128
      ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
264
0
    }
265
15.6k
  (void) CloseBlob(image);
266
15.6k
  image=DestroyImage(image);
267
15.6k
  read_info=CloneImageInfo(image_info);
268
15.6k
  read_info->number_scenes=1;
269
15.6k
  read_info->scene=0;
270
15.6k
  (void) CopyMagickString(read_info->magick,"EPS",MagickPathExtent);
271
15.6k
  if (ept_info.postscript_length != 0)
272
2.29k
    {
273
      /*
274
        Convert Postscript blob to image.
275
      */
276
2.29k
      image=BlobToImage(read_info,postscript_data,ept_info.postscript_length,
277
2.29k
        exception);
278
2.29k
      if (image != (Image *) NULL)
279
0
        {
280
0
          (void) CopyMagickString(image->filename,image_info->filename,
281
0
            MagickPathExtent);
282
0
          (void) CopyMagickString(image->magick,"EPT",MagickPathExtent);
283
0
        }
284
2.29k
    }
285
15.6k
  if (ept_info.tiff_length != 0)
286
15.0k
    {
287
      /*
288
        Convert TIFF blob to image.
289
      */
290
15.0k
      (void) CopyMagickString(read_info->magick,"TIFF",MagickPathExtent);
291
15.0k
      tiff_image=BlobToImage(read_info,tiff_data,ept_info.tiff_length,
292
15.0k
        exception);
293
15.0k
      if (tiff_image != (Image *) NULL)
294
5.14k
        {
295
5.14k
          if (image == (Image *) NULL)
296
5.14k
            image=tiff_image;
297
0
          else
298
0
            AppendImageToList(&image,tiff_image);
299
5.14k
        }
300
15.0k
    }
301
15.6k
  read_info=DestroyImageInfo(read_info);
302
15.6k
  ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
303
15.6k
  ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
304
15.6k
    ept_info.postscript);
305
15.6k
  return(GetFirstImageInList(image));
306
15.7k
}
307

308
/*
309
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310
%                                                                             %
311
%                                                                             %
312
%                                                                             %
313
%   R e g i s t e r E P T I m a g e                                           %
314
%                                                                             %
315
%                                                                             %
316
%                                                                             %
317
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
%
319
%  RegisterEPTImage() adds attributes for the EPT image format to
320
%  the list of supported formats.  The attributes include the image format
321
%  tag, a method to read and/or write the format, whether the format
322
%  supports the saving of more than one frame to the same file or blob,
323
%  whether the format supports native in-memory I/O, and a brief
324
%  description of the format.
325
%
326
%  The format of the RegisterEPTImage method is:
327
%
328
%      size_t RegisterEPTImage(void)
329
%
330
*/
331
ModuleExport size_t RegisterEPTImage(void)
332
10
{
333
10
  MagickInfo
334
10
    *entry;
335
336
10
  entry=AcquireMagickInfo("EPT","EPT",
337
10
    "Encapsulated PostScript with TIFF preview");
338
10
  entry->decoder=(DecodeImageHandler *) ReadEPTImage;
339
10
  entry->encoder=(EncodeImageHandler *) WriteEPTImage;
340
10
  entry->magick=(IsImageFormatHandler *) IsEPT;
341
10
  entry->flags|=CoderDecoderSeekableStreamFlag;
342
10
  entry->flags^=CoderAdjoinFlag;
343
10
  entry->flags^=CoderBlobSupportFlag;
344
10
  (void) RegisterMagickInfo(entry);
345
10
  entry=AcquireMagickInfo("EPT","EPT2",
346
10
    "Encapsulated PostScript Level II with TIFF preview");
347
10
  entry->decoder=(DecodeImageHandler *) ReadEPTImage;
348
10
  entry->encoder=(EncodeImageHandler *) WriteEPTImage;
349
10
  entry->magick=(IsImageFormatHandler *) IsEPT;
350
10
  entry->flags^=CoderAdjoinFlag;
351
10
  entry->flags|=CoderDecoderSeekableStreamFlag;
352
10
  entry->flags^=CoderBlobSupportFlag;
353
10
  (void) RegisterMagickInfo(entry);
354
10
  entry=AcquireMagickInfo("EPT","EPT3",
355
10
    "Encapsulated PostScript Level III with TIFF preview");
356
10
  entry->decoder=(DecodeImageHandler *) ReadEPTImage;
357
10
  entry->encoder=(EncodeImageHandler *) WriteEPTImage;
358
10
  entry->magick=(IsImageFormatHandler *) IsEPT;
359
10
  entry->flags|=CoderDecoderSeekableStreamFlag;
360
10
  entry->flags^=CoderBlobSupportFlag;
361
10
  (void) RegisterMagickInfo(entry);
362
10
  return(MagickImageCoderSignature);
363
10
}
364

365
/*
366
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367
%                                                                             %
368
%                                                                             %
369
%                                                                             %
370
%   U n r e g i s t e r E P T I m a g e                                       %
371
%                                                                             %
372
%                                                                             %
373
%                                                                             %
374
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375
%
376
%  UnregisterEPTImage() removes format registrations made by the
377
%  EPT module from the list of supported formats.
378
%
379
%  The format of the UnregisterEPTImage method is:
380
%
381
%      UnregisterEPTImage(void)
382
%
383
*/
384
ModuleExport void UnregisterEPTImage(void)
385
0
{
386
0
  (void) UnregisterMagickInfo("EPT");
387
0
}
388

389
/*
390
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391
%                                                                             %
392
%                                                                             %
393
%                                                                             %
394
%   W r i t e E P T I m a g e                                                 %
395
%                                                                             %
396
%                                                                             %
397
%                                                                             %
398
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399
%
400
%  WriteEPTImage() writes an image in the Encapsulated Postscript format
401
%  with a TIFF preview.
402
%
403
%  The format of the WriteEPTImage method is:
404
%
405
%      MagickBooleanType WriteEPTImage(const ImageInfo *image_info,
406
%        Image *image,ExceptionInfo *exception)
407
%
408
%  A description of each parameter follows.
409
%
410
%    o image_info: the image info.
411
%
412
%    o image:  The image.
413
%
414
%    o exception: return any errors or warnings in this structure.
415
%
416
*/
417
static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image,
418
  ExceptionInfo *exception)
419
0
{
420
0
  char
421
0
    filename[MagickPathExtent];
422
423
0
  EPTInfo
424
0
    ept_info;
425
426
0
  Image
427
0
    *write_image;
428
429
0
  ImageInfo
430
0
    *write_info;
431
432
0
  MagickBooleanType
433
0
    status;
434
435
  /*
436
    Write EPT image.
437
  */
438
0
  assert(image_info != (const ImageInfo *) NULL);
439
0
  assert(image_info->signature == MagickCoreSignature);
440
0
  assert(image != (Image *) NULL);
441
0
  assert(image->signature == MagickCoreSignature);
442
0
  if (IsEventLogging() != MagickFalse)
443
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
444
0
  assert(exception != (ExceptionInfo *) NULL);
445
0
  assert(exception->signature == MagickCoreSignature);
446
0
  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
447
0
  if (status == MagickFalse)
448
0
    return(status);
449
0
  write_image=CloneImage(image,0,0,MagickTrue,exception);
450
0
  if (write_image == (Image *) NULL)
451
0
    return(MagickFalse);
452
0
  write_info=CloneImageInfo(image_info);
453
0
  (void) CopyMagickString(write_info->filename,"EPS:",MagickPathExtent);
454
0
  (void) CopyMagickString(write_info->magick,"EPS",MagickPathExtent);
455
0
  if (LocaleCompare(image_info->magick,"EPT2") == 0)
456
0
    {
457
0
      (void) CopyMagickString(write_info->filename,"EPS2:",MagickPathExtent);
458
0
      (void) CopyMagickString(write_info->magick,"EPS2",MagickPathExtent);
459
0
    }
460
0
  if (LocaleCompare(image_info->magick,"EPT3") == 0)
461
0
    {
462
0
      (void) CopyMagickString(write_info->filename,"EPS3:",MagickPathExtent);
463
0
      (void) CopyMagickString(write_info->magick,"EPS3",MagickPathExtent);
464
0
    }
465
0
  (void) memset(&ept_info,0,sizeof(ept_info));
466
0
  ept_info.magick=0xc6d3d0c5ul;
467
0
  ept_info.postscript=(unsigned char *) ImageToBlob(write_info,write_image,
468
0
    &ept_info.postscript_length,exception);
469
0
  write_image=DestroyImage(write_image);
470
0
  write_info=DestroyImageInfo(write_info);
471
0
  if (ept_info.postscript == (void *) NULL)
472
0
    return(MagickFalse);
473
0
  write_image=CloneImage(image,0,0,MagickTrue,exception);
474
0
  if (write_image == (Image *) NULL)
475
0
    return(MagickFalse);
476
0
  write_info=CloneImageInfo(image_info);
477
0
  (void) CopyMagickString(write_info->magick,"TIFF",MagickPathExtent);
478
0
  (void) FormatLocaleString(filename,MagickPathExtent,"tiff:%s",
479
0
    write_info->filename);
480
0
  (void) CopyMagickString(write_info->filename,filename,MagickPathExtent);
481
0
  if ((write_image->columns > 512) || (write_image->rows > 512))
482
0
    {
483
0
      Image
484
0
        *resize_image;
485
486
0
      resize_image=ResizeImage(write_image,512,512,write_image->filter,
487
0
        exception);
488
0
      if (resize_image != (Image *) NULL)
489
0
        {
490
0
          write_image=DestroyImage(write_image);
491
0
          write_image=resize_image;
492
0
        }
493
0
    }
494
0
  if ((write_image->storage_class == DirectClass) ||
495
0
      (write_image->colors > 256))
496
0
    {
497
0
      QuantizeInfo
498
0
        quantize_info;
499
500
      /*
501
        EPT preview requires that the image is colormapped.
502
      */
503
0
      GetQuantizeInfo(&quantize_info);
504
0
      quantize_info.dither_method=IdentifyPaletteImage(write_image,
505
0
        exception) == MagickFalse ? RiemersmaDitherMethod : NoDitherMethod;
506
0
      (void) QuantizeImage(&quantize_info,write_image,exception);
507
0
    }
508
0
  write_info->compression=NoCompression;
509
0
  ept_info.tiff=(unsigned char *) ImageToBlob(write_info,write_image,
510
0
    &ept_info.tiff_length,exception);
511
0
  write_image=DestroyImage(write_image);
512
0
  write_info=DestroyImageInfo(write_info);
513
0
  if (ept_info.tiff == (void *) NULL)
514
0
    {
515
0
      ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
516
0
        ept_info.postscript);
517
0
      return(MagickFalse);
518
0
    }
519
  /*
520
    Write EPT image.
521
  */
522
0
  (void) WriteBlobLSBLong(image,(unsigned int) ept_info.magick);
523
0
  (void) WriteBlobLSBLong(image,30);
524
0
  (void) WriteBlobLSBLong(image,(unsigned int) ept_info.postscript_length);
525
0
  (void) WriteBlobLSBLong(image,0);
526
0
  (void) WriteBlobLSBLong(image,0);
527
0
  (void) WriteBlobLSBLong(image,(unsigned int) ept_info.postscript_length+30);
528
0
  (void) WriteBlobLSBLong(image,(unsigned int) ept_info.tiff_length);
529
0
  (void) WriteBlobLSBShort(image,0xffff);
530
0
  (void) WriteBlob(image,ept_info.postscript_length,ept_info.postscript);
531
0
  (void) WriteBlob(image,ept_info.tiff_length,ept_info.tiff);
532
  /*
533
    Relinquish resources.
534
  */
535
0
  ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
536
0
    ept_info.postscript);
537
0
  ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
538
0
  if (CloseBlob(image) == MagickFalse)
539
0
    status=MagickFalse;
540
0
  return(status);
541
0
}