Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 378169
Collapse All | Expand All

(-)pngtools-0.4.orig/pnginfo.c (-25 / +35 lines)
Lines 187-204 Link Here
187
  printf ("  Image Width: %d Image Length: %d\n", width, height);
187
  printf ("  Image Width: %d Image Length: %d\n", width, height);
188
  if(tiffnames == pnginfo_true){
188
  if(tiffnames == pnginfo_true){
189
    printf ("  Bits/Sample: %d\n", bitdepth);
189
    printf ("  Bits/Sample: %d\n", bitdepth);
190
    printf ("  Samples/Pixel: %d\n", info->channels);
190
    printf ("  Samples/Pixel: %d\n", png_get_channels(png, info));
191
    printf ("  Pixel Depth: %d\n", info->pixel_depth);	// Does this add value?
191
//    printf ("  Pixel Depth: %d\n", info->pixel_depth);	// Does this add value?
192
  }
192
  }
193
  else{
193
  else{
194
    printf ("  Bitdepth (Bits/Sample): %d\n", bitdepth);
194
    printf ("  Bitdepth (Bits/Sample): %d\n", bitdepth);
195
    printf ("  Channels (Samples/Pixel): %d\n", info->channels);
195
    printf ("  Channels (Samples/Pixel): %d\n", png_get_channels(png, info));
196
    printf ("  Pixel depth (Pixel Depth): %d\n", info->pixel_depth);	// Does this add value?
196
//    printf ("  Pixel depth (Pixel Depth): %d\n", info->pixel_depth);	// Does this add value?
197
  }
197
  }
198
198
199
  // Photometric interp packs a lot of information
199
  // Photometric interp packs a lot of information
200
  printf ("  Colour Type (Photometric Interpretation): ");
200
  printf ("  Colour Type (Photometric Interpretation): ");
201
201
202
  int num_palette;
203
  int num_trans;
204
202
  switch (colourtype)
205
  switch (colourtype)
203
    {
206
    {
204
    case PNG_COLOR_TYPE_GRAY:
207
    case PNG_COLOR_TYPE_GRAY:
Lines 207-216 Link Here
207
210
208
    case PNG_COLOR_TYPE_PALETTE:
211
    case PNG_COLOR_TYPE_PALETTE:
209
      printf ("PALETTED COLOUR ");
212
      printf ("PALETTED COLOUR ");
210
      if (info->num_trans > 0)
213
      if (num_trans > 0)
211
	printf ("with alpha ");
214
	printf ("with alpha ");
212
      printf ("(%d colours, %d transparent) ",
215
      printf ("(%d colours, %d transparent) ",
213
	      info->num_palette, info->num_trans);
216
	      num_palette, num_trans);
214
      break;
217
      break;
215
218
216
    case PNG_COLOR_TYPE_RGB:
219
    case PNG_COLOR_TYPE_RGB:
Lines 232-238 Link Here
232
  printf ("\n");
235
  printf ("\n");
233
236
234
  printf ("  Image filter: ");
237
  printf ("  Image filter: ");
235
  switch (info->filter_type)
238
  switch (png_get_filter_type(png, info))
236
    {
239
    {
237
    case PNG_FILTER_TYPE_BASE:
240
    case PNG_FILTER_TYPE_BASE:
238
      printf ("Single row per byte filter ");
241
      printf ("Single row per byte filter ");
Lines 249-255 Link Here
249
  printf ("\n");
252
  printf ("\n");
250
253
251
  printf ("  Interlacing: ");
254
  printf ("  Interlacing: ");
252
  switch (info->interlace_type)
255
  switch (png_get_interlace_type(png, info))
253
    {
256
    {
254
    case PNG_INTERLACE_NONE:
257
    case PNG_INTERLACE_NONE:
255
      printf ("No interlacing ");
258
      printf ("No interlacing ");
Lines 266-272 Link Here
266
  printf ("\n");
269
  printf ("\n");
267
270
268
  printf ("  Compression Scheme: ");
271
  printf ("  Compression Scheme: ");
269
  switch (info->compression_type)
272
  switch (png_get_compression_type(png, info))
270
    {
273
    {
271
    case PNG_COMPRESSION_TYPE_BASE:
274
    case PNG_COMPRESSION_TYPE_BASE:
272
      printf ("Deflate method 8, 32k window");
275
      printf ("Deflate method 8, 32k window");
Lines 278-286 Link Here
278
    }
281
    }
279
  printf ("\n");
282
  printf ("\n");
280
283
284
  png_uint_32 x_pixels_per_unit, y_pixels_per_unit;
285
  int phys_unit_type;
286
  png_get_pHYs (png, info, &x_pixels_per_unit, &y_pixels_per_unit, &phys_unit_type);
287
281
  printf ("  Resolution: %d, %d ",
288
  printf ("  Resolution: %d, %d ",
282
	  info->x_pixels_per_unit, info->y_pixels_per_unit);
289
	  x_pixels_per_unit, y_pixels_per_unit);
283
  switch (info->phys_unit_type)
290
  switch (phys_unit_type)
284
    {
291
    {
285
    case PNG_RESOLUTION_UNKNOWN:
292
    case PNG_RESOLUTION_UNKNOWN:
286
      printf ("(unit unknown)");
293
      printf ("(unit unknown)");
Lines 299-313 Link Here
299
  // FillOrder is always msb-to-lsb, big endian
306
  // FillOrder is always msb-to-lsb, big endian
300
  printf ("  FillOrder: msb-to-lsb\n  Byte Order: Network (Big Endian)\n");
307
  printf ("  FillOrder: msb-to-lsb\n  Byte Order: Network (Big Endian)\n");
301
308
309
  png_textp text;
310
  int num_text, max_text;
311
302
  // Text comments
312
  // Text comments
303
  printf ("  Number of text strings: %d of %d\n",
313
  printf ("  Number of text strings: %d of %d\n",
304
	  info->num_text, info->max_text);
314
	  num_text, max_text);
305
315
306
  for (i = 0; i < info->num_text; i++)
316
  for (i = 0; i < num_text; i++)
307
    {
317
    {
308
      printf ("    %s ", info->text[i].key);
318
      printf ("    %s ", text[i].key);
309
319
310
      switch (info->text[1].compression)
320
      switch (text[1].compression)
311
	{
321
	{
312
	case -1:
322
	case -1:
313
	  printf ("(tEXt uncompressed)");
323
	  printf ("(tEXt uncompressed)");
Lines 332-343 Link Here
332
342
333
      printf (": ");
343
      printf (": ");
334
      j = 0;
344
      j = 0;
335
      while (info->text[i].text[j] != '\0')
345
      while (text[i].text[j] != '\0')
336
	{
346
	{
337
	  if (info->text[i].text[j] == '\n')
347
	  if (text[i].text[j] == '\n')
338
	    printf ("\\n");
348
	    printf ("\\n");
339
	  else
349
	  else
340
	    fputc (info->text[i].text[j], stdout);
350
	    fputc (text[i].text[j], stdout);
341
351
342
	  j++;
352
	  j++;
343
	}
353
	}
Lines 385-398 Link Here
385
395
386
	  printf ("Dumping the bitmap for this image:\n");
396
	  printf ("Dumping the bitmap for this image:\n");
387
	  printf ("(Expanded samples result in %d bytes per pixel, %d channels with %d bytes per channel)\n\n", 
397
	  printf ("(Expanded samples result in %d bytes per pixel, %d channels with %d bytes per channel)\n\n", 
388
		  info->channels * bytespersample, info->channels, bytespersample);
398
		  png_get_channels(png, info) * bytespersample, png_get_channels(png, info), bytespersample);
389
399
390
	  // runlen is used to stop us displaying repeated byte patterns over and over --
400
	  // runlen is used to stop us displaying repeated byte patterns over and over --
391
	  // I display them once, and then tell you how many times it occured in the file.
401
	  // I display them once, and then tell you how many times it occured in the file.
392
	  // This currently only applies to runs on zeros -- I should one day add an
402
	  // This currently only applies to runs on zeros -- I should one day add an
393
	  // option to extend this to runs of other values as well
403
	  // option to extend this to runs of other values as well
394
	  runlen = 0;
404
	  runlen = 0;
395
	  for (i = 0; i < rowbytes * height / info->channels; i += info->channels * bytespersample)
405
	  for (i = 0; i < rowbytes * height / png_get_channels(png, info); i += png_get_channels(png, info) * bytespersample)
396
	    {
406
	    {
397
	      int scount, bcount, pixel;
407
	      int scount, bcount, pixel;
398
408
Lines 408-423 Link Here
408
418
409
	      // Determine if this is a pixel whose entire value is zero
419
	      // Determine if this is a pixel whose entire value is zero
410
	      pixel = 0;
420
	      pixel = 0;
411
	      for(scount = 0; scount < info->channels; scount++)
421
	      for(scount = 0; scount < png_get_channels(png, info); scount++)
412
		for(bcount = 0; bcount < bytespersample; bcount++)
422
		for(bcount = 0; bcount < bytespersample; bcount++)
413
		  pixel += bitmap[i + scount * bytespersample + bcount];
423
		  pixel += bitmap[i + scount * bytespersample + bcount];
414
424
415
	      if ((runlen == 0) && !pixel)
425
	      if ((runlen == 0) && !pixel)
416
		{
426
		{
417
		  printf ("[");
427
		  printf ("[");
418
		  for(scount = 0; scount < info->channels; scount++){
428
		  for(scount = 0; scount < png_get_channels(png, info); scount++){
419
		    for(bcount = 0; bcount < bytespersample; bcount++) printf("00");
429
		    for(bcount = 0; bcount < bytespersample; bcount++) printf("00");
420
		    if(scount != info->channels - 1) printf(" ");
430
		    if(scount != png_get_channels(png, info) - 1) printf(" ");
421
		  }
431
		  }
422
		  printf ("] ");
432
		  printf ("] ");
423
		  runlen++;
433
		  runlen++;
Lines 425-434 Link Here
425
435
426
	      if (runlen == 0){
436
	      if (runlen == 0){
427
		printf ("[");
437
		printf ("[");
428
		for(scount = 0; scount < info->channels; scount++){
438
		for(scount = 0; scount < png_get_channels(png, info); scount++){
429
		  for(bcount = 0; bcount < bytespersample; bcount++)
439
		  for(bcount = 0; bcount < bytespersample; bcount++)
430
		    printf("%02x", (unsigned char) bitmap[i + scount * bytespersample + bcount]);
440
		    printf("%02x", (unsigned char) bitmap[i + scount * bytespersample + bcount]);
431
		  if(scount != info->channels - 1) printf(" ");
441
		  if(scount != png_get_channels(png, info) - 1) printf(" ");
432
		}
442
		}
433
		printf("] ");
443
		printf("] ");
434
	      }
444
	      }
(-)pngtools-0.4.orig/pngread.c (-1 / +1 lines)
Lines 68-74 Link Here
68
  // palette is correctly reported...
68
  // palette is correctly reported...
69
  //png_set_strip_alpha (png);
69
  //png_set_strip_alpha (png);
70
  png_read_update_info (png, info);
70
  png_read_update_info (png, info);
71
  *channels = info->channels;
71
  *channels = png_get_channels(png, info);
72
  
72
  
73
  rowbytes = png_get_rowbytes (png, info);
73
  rowbytes = png_get_rowbytes (png, info);
74
  if((row_pointers = malloc (*height * sizeof (png_bytep))) == NULL){
74
  if((row_pointers = malloc (*height * sizeof (png_bytep))) == NULL){

Return to bug 378169