MCPcopy Create free account
hub / github.com/LibRaw/LibRaw / tiff_head

Function tiff_head

samples/unprocessed_raw.cpp:273–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271#define TOFF(ptr) ((char *)(&(ptr)) - (char *)th)
272
273void tiff_head(int width, int height, struct tiff_hdr *th)
274{
275 int c;
276 time_t timestamp = time(NULL);
277 struct tm *t;
278
279 memset(th, 0, sizeof *th);
280 th->t_order = htonl(0x4d4d4949) >> 16;
281 th->magic = 42;
282 th->ifd = 10;
283 tiff_set(&th->ntag, 254, 4, 1, 0);
284 tiff_set(&th->ntag, 256, 4, 1, width);
285 tiff_set(&th->ntag, 257, 4, 1, height);
286 tiff_set(&th->ntag, 258, 3, 1, 16);
287 for (c = 0; c < 4; c++)
288 th->bps[c] = 16;
289 tiff_set(&th->ntag, 259, 3, 1, 1);
290 tiff_set(&th->ntag, 262, 3, 1, 1);
291 tiff_set(&th->ntag, 273, 4, 1, sizeof *th);
292 tiff_set(&th->ntag, 277, 3, 1, 1);
293 tiff_set(&th->ntag, 278, 4, 1, height);
294 tiff_set(&th->ntag, 279, 4, 1, height * width * 2);
295 tiff_set(&th->ntag, 282, 5, 1, TOFF(th->rat[0]));
296 tiff_set(&th->ntag, 283, 5, 1, TOFF(th->rat[2]));
297 tiff_set(&th->ntag, 284, 3, 1, 1);
298 tiff_set(&th->ntag, 296, 3, 1, 2);
299 tiff_set(&th->ntag, 306, 2, 20, TOFF(th->date));
300 th->rat[0] = th->rat[2] = 300;
301 th->rat[1] = th->rat[3] = 1;
302 t = localtime(&timestamp);
303 if (t)
304 sprintf(th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900,
305 t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
306}
307
308void write_tiff(int width, int height, unsigned short *bitmap, const char *fn)
309{

Callers 4

write_tiffFunction · 0.85
dcraw_make_mem_thumbMethod · 0.85
jpeg_thumb_writerMethod · 0.85
write_ppm_tiffMethod · 0.85

Calls 1

tiff_setFunction · 0.85

Tested by

no test coverage detected