Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/jbig2dec/pbm2png.c @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* Copyright (C) 2001-2023 Artifex Software, Inc. | |
| 2 All Rights Reserved. | |
| 3 | |
| 4 This software is provided AS-IS with no warranty, either express or | |
| 5 implied. | |
| 6 | |
| 7 This software is distributed under license and may not be copied, | |
| 8 modified or distributed except as expressly authorized under the terms | |
| 9 of the license contained in the file LICENSE in this distribution. | |
| 10 | |
| 11 Refer to licensing information at http://www.artifex.com or contact | |
| 12 Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, | |
| 13 CA 94129, USA, for further information. | |
| 14 */ | |
| 15 | |
| 16 /* | |
| 17 jbig2dec | |
| 18 */ | |
| 19 | |
| 20 #ifdef HAVE_CONFIG_H | |
| 21 #include "config.h" | |
| 22 #include "config_types.h" | |
| 23 #elif _WIN32 | |
| 24 #include "config_win32.h" | |
| 25 #endif | |
| 26 #ifdef HAVE_STDINT_H | |
| 27 #include <stdint.h> | |
| 28 #endif | |
| 29 | |
| 30 #include <stdio.h> | |
| 31 #include <stdlib.h> | |
| 32 #include <string.h> | |
| 33 | |
| 34 #include "jbig2.h" | |
| 35 #include "jbig2_image.h" | |
| 36 #include "jbig2_image_rw.h" | |
| 37 | |
| 38 int | |
| 39 main(int argc, char *argv[]) | |
| 40 { | |
| 41 Jbig2Ctx *ctx; | |
| 42 Jbig2Image *image; | |
| 43 int code; | |
| 44 | |
| 45 /* we need a context for the allocators */ | |
| 46 ctx = jbig2_ctx_new(NULL, 0, NULL, NULL, NULL); | |
| 47 | |
| 48 if (argc != 3) { | |
| 49 fprintf(stderr, "usage: %s <in.pbm> <out.png>\n\n", argv[0]); | |
| 50 return 1; | |
| 51 } | |
| 52 | |
| 53 image = jbig2_image_read_pbm_file(ctx, argv[1]); | |
| 54 if (image == NULL) { | |
| 55 fprintf(stderr, "error reading pbm file '%s'\n", argv[1]); | |
| 56 return 1; | |
| 57 } else { | |
| 58 fprintf(stderr, "converting %dx%d image to png format\n", image->width, image->height); | |
| 59 } | |
| 60 | |
| 61 code = jbig2_image_write_png_file(image, argv[2]); | |
| 62 if (code) { | |
| 63 fprintf(stderr, "error writing png file '%s' error %d\n", argv[2], code); | |
| 64 } | |
| 65 | |
| 66 return (code); | |
| 67 } |
