4 main(int argc
, char *argv
[])
6 char *in_path
, *out_path
;
7 unsigned long width
, height
, channels
, size
, compression_mode
, demosaic_fast
;
8 unsigned long long start
;
10 int bayer_pattern
[2] = {0x00ff00, 0x0000ff};
11 double color_raiser
[3] = {1, 1, 1};
15 setvbuf(stdout
, NULL
, _IONBF
, 0);
18 width
= strtoul(argv
[2], NULL
, 10);
19 height
= strtoul(argv
[3], NULL
, 10);
20 channels
= strtoul(argv
[4], NULL
, 10);
21 start
= strtoull(argv
[5], NULL
, 10);
22 size
= strtoul(argv
[6], NULL
, 10);
23 compression_mode
= strtoul(argv
[7], NULL
, 10);
24 demosaic_fast
= strtoul(argv
[8], NULL
, 10);
25 sscanf(argv
[9], "%lf, %lf, %lf",
26 &color_raiser
[0], &color_raiser
[1], &color_raiser
[2]);
28 err
= png2mem(in_path
, start
, size
, width
, height
, channels
,
29 bayer_pattern
, demosaic_fast
, compression_mode
,
30 &mp
, false, false, color_raiser
);
31 fp
= fopen(out_path
, "wb");
33 fprintf(stderr
, "Could not open file %s for writing\n", out_path
);
36 fwrite(mp
.buffer
, mp
.size
, sizeof(mp
.buffer
[0]), fp
);
37 printf("status=%d\n", err
);
38 printf("in_path=%s width=%ld height=%ld channels=%ld "
39 "start=%lld size=%ld compression_mode=%ld "
40 "demosaic_fast=%ld color_raiser=%.1lf,%.1lf,%.1lf "
42 in_path
, width
, height
, channels
, start
, size
,
43 compression_mode
, demosaic_fast
,
44 color_raiser
[0], color_raiser
[1], color_raiser
[2],
51 printf("ping = %d\n", ping(strtoul(argv
[1], NULL
, 10)));
54 printf("Usage: %s in_path width height channels start size "
55 "compression_mode demosaic_fast color_raiser out_path\n",
60 /* ./imreadtest mitsa005_CCD_Front_PULNIX_13.pictures 1700 1500 3 2264 1392908 2 1 1,1,1 m.png */
61 /* ./imreadtest phoros_20110405_002_CCDHECK_01_PULNIX_11.pictures 1920 1080 1 1363 1384533 2 1 1,1,1 p.png */
62 /* ./imreadtest 15294_IRIS3_20160519_000_CCD_RETRO_ZEB_1.pictures 1920 1080 4 1210 598189 3 1 1,1,1 j.png */
63 /* ./imreadtest 15294_IRIS3_20160609_004_CCD_Front_1.pictures 1280 960 3 2009 723324 2 1 1,1,1 b.png */
64 /* ./imreadtest 15294_IRIS3_20160609_004_CCD_Front_1.pictures 1280 960 3 2125833547 682281 2 1 1,1,1 b.png */
65 /* ./imreadtest 15294_IRIS3_20160609_004_CCD_Front_1.pictures 1280 960 3 2185929330 682393 2 1 1,1,1 b.png */