blob: 6fe22d7f89cc56ed3e3cefaa4af24b4304bce33e [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% X X BBBB M M %
7% X X B B MM MM %
8% X BBBB M M M %
9% X X B B M M %
10% X X BBBB M M %
11% %
12% %
13% Read/Write X Windows System Bitmap Format %
14% %
15% Software Design %
16% John Cristy %
17% July 1992 %
18% %
19% %
cristy7e41fe82010-12-04 23:12:08 +000020% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000021% 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% http://www.imagemagick.org/script/license.php %
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*/
cristy4c08aed2011-07-01 19:47:50 +000042#include "MagickCore/studio.h"
43#include "MagickCore/blob.h"
44#include "MagickCore/blob-private.h"
45#include "MagickCore/cache.h"
46#include "MagickCore/color-private.h"
47#include "MagickCore/colormap.h"
48#include "MagickCore/colorspace.h"
49#include "MagickCore/exception.h"
50#include "MagickCore/exception-private.h"
51#include "MagickCore/image.h"
52#include "MagickCore/image-private.h"
53#include "MagickCore/list.h"
54#include "MagickCore/magick.h"
55#include "MagickCore/memory_.h"
56#include "MagickCore/monitor.h"
57#include "MagickCore/monitor-private.h"
58#include "MagickCore/pixel-accessor.h"
59#include "MagickCore/quantum-private.h"
60#include "MagickCore/static.h"
61#include "MagickCore/string_.h"
62#include "MagickCore/module.h"
63#include "MagickCore/utility.h"
cristy3ed852e2009-09-05 21:47:34 +000064
65/*
66 Forward declarations.
67*/
68static MagickBooleanType
69 WriteXBMImage(const ImageInfo *,Image *);
70
71/*
72%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73% %
74% %
75% %
76% I s X B M %
77% %
78% %
79% %
80%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81%
82% IsXBM() returns MagickTrue if the image format type, identified by the
83% magick string, is XBM.
84%
85% The format of the IsXBM method is:
86%
87% MagickBooleanType IsXBM(const unsigned char *magick,const size_t length)
88%
89% A description of each parameter follows:
90%
91% o magick: compare image format pattern against these bytes.
92%
93% o length: Specifies the length of the magick string.
94%
95*/
96static MagickBooleanType IsXBM(const unsigned char *magick,const size_t length)
97{
98 if (length < 7)
99 return(MagickFalse);
100 if (memcmp(magick,"#define",7) == 0)
101 return(MagickTrue);
102 return(MagickFalse);
103}
104
105/*
106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107% %
108% %
109% %
110% R e a d X B M I m a g e %
111% %
112% %
113% %
114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115%
116% ReadXBMImage() reads an X11 bitmap image file and returns it. It
117% allocates the memory necessary for the new Image structure and returns a
118% pointer to the new image.
119%
120% The format of the ReadXBMImage method is:
121%
122% Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
123%
124% A description of each parameter follows:
125%
126% o image_info: the image info.
127%
128% o exception: return any errors or warnings in this structure.
129%
130*/
131
132static int XBMInteger(Image *image,short int *hex_digits)
133{
134 int
135 c,
136 flag,
137 value;
138
139 value=0;
140 flag=0;
141 for ( ; ; )
142 {
143 c=ReadBlobByte(image);
144 if (c == EOF)
145 {
146 value=(-1);
147 break;
148 }
149 c&=0xff;
150 if (isxdigit(c) != MagickFalse)
151 {
cristybb503372010-05-27 20:51:26 +0000152 value=(int) ((size_t) value << 4)+hex_digits[c];
cristy3ed852e2009-09-05 21:47:34 +0000153 flag++;
154 continue;
155 }
156 if ((hex_digits[c]) < 0 && (flag != 0))
157 break;
158 }
159 return(value);
160}
161
162static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
163{
164 char
165 buffer[MaxTextExtent],
166 name[MaxTextExtent];
167
168 Image
169 *image;
170
cristy3ed852e2009-09-05 21:47:34 +0000171 MagickBooleanType
172 status;
173
cristybb503372010-05-27 20:51:26 +0000174 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000175 i,
176 x;
177
cristy4c08aed2011-07-01 19:47:50 +0000178 register Quantum
cristy3ed852e2009-09-05 21:47:34 +0000179 *q;
180
181 register unsigned char
182 *p;
183
184 short int
185 hex_digits[256];
186
187 size_t
cristy3ed852e2009-09-05 21:47:34 +0000188 bit,
189 byte,
190 bytes_per_line,
cristyc6da28e2011-04-28 01:41:35 +0000191 length,
cristy3ed852e2009-09-05 21:47:34 +0000192 padding,
193 value,
194 version;
195
cristyc6da28e2011-04-28 01:41:35 +0000196 ssize_t
197 y;
198
199 unsigned char
200 *data;
201
cristyf1d91242010-05-28 02:23:19 +0000202 unsigned long
203 height,
204 width;
205
cristy3ed852e2009-09-05 21:47:34 +0000206 /*
207 Open image file.
208 */
209 assert(image_info != (const ImageInfo *) NULL);
210 assert(image_info->signature == MagickSignature);
211 if (image_info->debug != MagickFalse)
212 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
213 image_info->filename);
214 assert(exception != (ExceptionInfo *) NULL);
215 assert(exception->signature == MagickSignature);
216 image=AcquireImage(image_info);
217 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
218 if (status == MagickFalse)
219 {
220 image=DestroyImageList(image);
221 return((Image *) NULL);
222 }
223 /*
224 Read X bitmap header.
225 */
cristyf1d91242010-05-28 02:23:19 +0000226 width=0;
227 height=0;
cristy3ed852e2009-09-05 21:47:34 +0000228 while (ReadBlobString(image,buffer) != (char *) NULL)
cristyf1d91242010-05-28 02:23:19 +0000229 if (sscanf(buffer,"#define %s %lu",name,&width) == 2)
cristy3ed852e2009-09-05 21:47:34 +0000230 if ((strlen(name) >= 6) &&
231 (LocaleCompare(name+strlen(name)-6,"_width") == 0))
cristyf1d91242010-05-28 02:23:19 +0000232 break;
cristy3ed852e2009-09-05 21:47:34 +0000233 while (ReadBlobString(image,buffer) != (char *) NULL)
cristyf1d91242010-05-28 02:23:19 +0000234 if (sscanf(buffer,"#define %s %lu",name,&height) == 2)
cristy3ed852e2009-09-05 21:47:34 +0000235 if ((strlen(name) >= 7) &&
236 (LocaleCompare(name+strlen(name)-7,"_height") == 0))
cristyf1d91242010-05-28 02:23:19 +0000237 break;
238 image->columns=width;
cristy9768b932010-11-19 17:11:01 +0000239 image->rows=height;
cristy3ed852e2009-09-05 21:47:34 +0000240 image->depth=8;
241 image->storage_class=PseudoClass;
242 image->colors=2;
243 /*
244 Scan until hex digits.
245 */
246 version=11;
247 while (ReadBlobString(image,buffer) != (char *) NULL)
248 {
249 if (sscanf(buffer,"static short %s = {",name) == 1)
250 version=10;
251 else
252 if (sscanf(buffer,"static unsigned char %s = {",name) == 1)
253 version=11;
254 else
255 if (sscanf(buffer,"static char %s = {",name) == 1)
256 version=11;
257 else
258 continue;
259 p=(unsigned char *) strrchr(name,'_');
260 if (p == (unsigned char *) NULL)
261 p=(unsigned char *) name;
262 else
263 p++;
264 if (LocaleCompare("bits[]",(char *) p) == 0)
265 break;
266 }
267 if ((image->columns == 0) || (image->rows == 0) ||
268 (EOFBlob(image) != MagickFalse))
269 ThrowReaderException(CorruptImageError,"ImproperImageHeader");
270 /*
271 Initialize image structure.
272 */
273 if (AcquireImageColormap(image,image->colors) == MagickFalse)
274 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
275 /*
276 Initialize colormap.
277 */
278 image->colormap[0].red=(Quantum) QuantumRange;
279 image->colormap[0].green=(Quantum) QuantumRange;
280 image->colormap[0].blue=(Quantum) QuantumRange;
281 image->colormap[1].red=(Quantum) 0;
282 image->colormap[1].green=(Quantum) 0;
283 image->colormap[1].blue=(Quantum) 0;
284 if (image_info->ping != MagickFalse)
285 {
286 (void) CloseBlob(image);
287 return(GetFirstImageInList(image));
288 }
289 /*
290 Initialize hex values.
291 */
292 hex_digits[(int) '0']=0;
293 hex_digits[(int) '1']=1;
294 hex_digits[(int) '2']=2;
295 hex_digits[(int) '3']=3;
296 hex_digits[(int) '4']=4;
297 hex_digits[(int) '5']=5;
298 hex_digits[(int) '6']=6;
299 hex_digits[(int) '7']=7;
300 hex_digits[(int) '8']=8;
301 hex_digits[(int) '9']=9;
302 hex_digits[(int) 'A']=10;
303 hex_digits[(int) 'B']=11;
304 hex_digits[(int) 'C']=12;
305 hex_digits[(int) 'D']=13;
306 hex_digits[(int) 'E']=14;
307 hex_digits[(int) 'F']=15;
308 hex_digits[(int) 'a']=10;
309 hex_digits[(int) 'b']=11;
310 hex_digits[(int) 'c']=12;
311 hex_digits[(int) 'd']=13;
312 hex_digits[(int) 'e']=14;
313 hex_digits[(int) 'f']=15;
314 hex_digits[(int) 'x']=0;
315 hex_digits[(int) ' ']=(-1);
316 hex_digits[(int) ',']=(-1);
317 hex_digits[(int) '}']=(-1);
318 hex_digits[(int) '\n']=(-1);
319 hex_digits[(int) '\t']=(-1);
320 /*
321 Read hex image data.
322 */
323 padding=0;
324 if (((image->columns % 16) != 0) &&
325 ((image->columns % 16) < 9) && (version == 10))
326 padding=1;
327 bytes_per_line=(image->columns+7)/8+padding;
328 length=(size_t) image->rows;
329 data=(unsigned char *) AcquireQuantumMemory(length,bytes_per_line*
330 sizeof(*data));
331 if (data == (unsigned char *) NULL)
332 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
333 p=data;
334 if (version == 10)
cristybb503372010-05-27 20:51:26 +0000335 for (i=0; i < (ssize_t) (bytes_per_line*image->rows); (i+=2))
cristy3ed852e2009-09-05 21:47:34 +0000336 {
cristybb503372010-05-27 20:51:26 +0000337 value=(size_t) XBMInteger(image,hex_digits);
cristy3ed852e2009-09-05 21:47:34 +0000338 *p++=(unsigned char) value;
339 if ((padding == 0) || (((i+2) % bytes_per_line) != 0))
340 *p++=(unsigned char) (value >> 8);
341 }
342 else
cristybb503372010-05-27 20:51:26 +0000343 for (i=0; i < (ssize_t) (bytes_per_line*image->rows); i++)
cristy3ed852e2009-09-05 21:47:34 +0000344 {
cristybb503372010-05-27 20:51:26 +0000345 value=(size_t) XBMInteger(image,hex_digits);
cristy3ed852e2009-09-05 21:47:34 +0000346 *p++=(unsigned char) value;
347 }
348 /*
349 Convert X bitmap image to pixel packets.
350 */
351 p=data;
cristybb503372010-05-27 20:51:26 +0000352 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +0000353 {
354 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000355 if (q == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000356 break;
cristy3ed852e2009-09-05 21:47:34 +0000357 bit=0;
358 byte=0;
cristybb503372010-05-27 20:51:26 +0000359 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000360 {
361 if (bit == 0)
cristybb503372010-05-27 20:51:26 +0000362 byte=(size_t) (*p++);
cristy4c08aed2011-07-01 19:47:50 +0000363 SetPixelIndex(image,(byte & 0x01) != 0 ? 0x01 : 0x00,q);
cristy3ed852e2009-09-05 21:47:34 +0000364 bit++;
365 byte>>=1;
366 if (bit == 8)
367 bit=0;
cristy4c08aed2011-07-01 19:47:50 +0000368 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000369 }
370 if (SyncAuthenticPixels(image,exception) == MagickFalse)
371 break;
cristycee97112010-05-28 00:44:52 +0000372 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
cristyc6da28e2011-04-28 01:41:35 +0000373 image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000374 if (status == MagickFalse)
375 break;
376 }
377 data=(unsigned char *) RelinquishMagickMemory(data);
378 (void) SyncImage(image);
379 (void) CloseBlob(image);
380 return(GetFirstImageInList(image));
381}
382
383/*
384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
385% %
386% %
387% %
388% R e g i s t e r X B M I m a g e %
389% %
390% %
391% %
392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
393%
394% RegisterXBMImage() adds attributes for the XBM image format to
395% the list of supported formats. The attributes include the image format
396% tag, a method to read and/or write the format, whether the format
397% supports the saving of more than one frame to the same file or blob,
398% whether the format supports native in-memory I/O, and a brief
399% description of the format.
400%
401% The format of the RegisterXBMImage method is:
402%
cristybb503372010-05-27 20:51:26 +0000403% size_t RegisterXBMImage(void)
cristy3ed852e2009-09-05 21:47:34 +0000404%
405*/
cristybb503372010-05-27 20:51:26 +0000406ModuleExport size_t RegisterXBMImage(void)
cristy3ed852e2009-09-05 21:47:34 +0000407{
408 MagickInfo
409 *entry;
410
411 entry=SetMagickInfo("XBM");
412 entry->decoder=(DecodeImageHandler *) ReadXBMImage;
413 entry->encoder=(EncodeImageHandler *) WriteXBMImage;
414 entry->magick=(IsImageFormatHandler *) IsXBM;
415 entry->adjoin=MagickFalse;
416 entry->description=ConstantString(
417 "X Windows system bitmap (black and white)");
418 entry->module=ConstantString("XBM");
419 (void) RegisterMagickInfo(entry);
420 return(MagickImageCoderSignature);
421}
422
423/*
424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425% %
426% %
427% %
428% U n r e g i s t e r X B M I m a g e %
429% %
430% %
431% %
432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433%
434% UnregisterXBMImage() removes format registrations made by the
435% XBM module from the list of supported formats.
436%
437% The format of the UnregisterXBMImage method is:
438%
439% UnregisterXBMImage(void)
440%
441*/
442ModuleExport void UnregisterXBMImage(void)
443{
444 (void) UnregisterMagickInfo("XBM");
445}
446
447/*
448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
449% %
450% %
451% %
452% W r i t e X B M I m a g e %
453% %
454% %
455% %
456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457%
458% Procedure WriteXBMImage() writes an image to a file in the X bitmap format.
459%
460% The format of the WriteXBMImage method is:
461%
462% MagickBooleanType WriteXBMImage(const ImageInfo *image_info,Image *image)
463%
464% A description of each parameter follows.
465%
466% o image_info: the image info.
467%
468% o image: The image.
469%
470%
471*/
472static MagickBooleanType WriteXBMImage(const ImageInfo *image_info,Image *image)
473{
474 char
475 basename[MaxTextExtent],
476 buffer[MaxTextExtent];
477
cristy3ed852e2009-09-05 21:47:34 +0000478 MagickBooleanType
479 status;
480
cristy4c08aed2011-07-01 19:47:50 +0000481 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +0000482 *p;
483
cristybb503372010-05-27 20:51:26 +0000484 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000485 x;
486
cristybb503372010-05-27 20:51:26 +0000487 size_t
cristy3ed852e2009-09-05 21:47:34 +0000488 bit,
489 byte;
490
cristyc6da28e2011-04-28 01:41:35 +0000491 ssize_t
492 count,
493 y;
494
cristy3ed852e2009-09-05 21:47:34 +0000495 /*
496 Open output image file.
497 */
498 assert(image_info != (const ImageInfo *) NULL);
499 assert(image_info->signature == MagickSignature);
500 assert(image != (Image *) NULL);
501 assert(image->signature == MagickSignature);
502 if (image->debug != MagickFalse)
503 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
504 status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
505 if (status == MagickFalse)
506 return(status);
507 if (image->colorspace != RGBColorspace)
508 (void) TransformImageColorspace(image,RGBColorspace);
509 /*
510 Write X bitmap header.
511 */
512 GetPathComponent(image->filename,BasePath,basename);
cristyb51dff52011-05-19 16:55:47 +0000513 (void) FormatLocaleString(buffer,MaxTextExtent,"#define %s_width %.20g\n",
cristye8c25f92010-06-03 00:53:06 +0000514 basename,(double) image->columns);
cristy3ed852e2009-09-05 21:47:34 +0000515 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
cristyb51dff52011-05-19 16:55:47 +0000516 (void) FormatLocaleString(buffer,MaxTextExtent,"#define %s_height %.20g\n",
cristye8c25f92010-06-03 00:53:06 +0000517 basename,(double) image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000518 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
cristyb51dff52011-05-19 16:55:47 +0000519 (void) FormatLocaleString(buffer,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +0000520 "static char %s_bits[] = {\n",basename);
521 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
522 (void) CopyMagickString(buffer," ",MaxTextExtent);
523 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
524 /*
525 Convert MIFF to X bitmap pixels.
526 */
527 (void) SetImageType(image,BilevelType);
528 bit=0;
529 byte=0;
530 count=0;
531 x=0;
532 y=0;
533 (void) CopyMagickString(buffer," ",MaxTextExtent);
534 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
cristybb503372010-05-27 20:51:26 +0000535 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +0000536 {
537 p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
cristy4c08aed2011-07-01 19:47:50 +0000538 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000539 break;
cristybb503372010-05-27 20:51:26 +0000540 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000541 {
542 byte>>=1;
cristy4c08aed2011-07-01 19:47:50 +0000543 if (GetPixelIntensity(image,p) < ((MagickRealType) QuantumRange/2.0))
cristy3ed852e2009-09-05 21:47:34 +0000544 byte|=0x80;
545 bit++;
546 if (bit == 8)
547 {
548 /*
549 Write a bitmap byte to the image file.
550 */
cristyb51dff52011-05-19 16:55:47 +0000551 (void) FormatLocaleString(buffer,MaxTextExtent,"0x%02X, ",
cristy3ed852e2009-09-05 21:47:34 +0000552 (unsigned int) (byte & 0xff));
553 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
554 count++;
555 if (count == 12)
556 {
557 (void) CopyMagickString(buffer,"\n ",MaxTextExtent);
558 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
559 count=0;
560 };
561 bit=0;
562 byte=0;
563 }
cristy4c08aed2011-07-01 19:47:50 +0000564 p+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000565 }
566 if (bit != 0)
567 {
568 /*
569 Write a bitmap byte to the image file.
570 */
571 byte>>=(8-bit);
cristyb51dff52011-05-19 16:55:47 +0000572 (void) FormatLocaleString(buffer,MaxTextExtent,"0x%02X, ",
cristy3ed852e2009-09-05 21:47:34 +0000573 (unsigned int) (byte & 0xff));
574 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
575 count++;
576 if (count == 12)
577 {
578 (void) CopyMagickString(buffer,"\n ",MaxTextExtent);
579 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
580 count=0;
581 };
582 bit=0;
583 byte=0;
584 };
cristycee97112010-05-28 00:44:52 +0000585 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
cristyc6da28e2011-04-28 01:41:35 +0000586 image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000587 if (status == MagickFalse)
588 break;
589 }
590 (void) CopyMagickString(buffer,"};\n",MaxTextExtent);
591 (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
592 (void) CloseBlob(image);
593 return(MagickTrue);
594}