Amiga.org

Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: maxmania on November 10, 2007, 12:07:13 PM

Title: Unknown IFF Format / Help me please !!!
Post by: maxmania on November 10, 2007, 12:07:13 PM
Hello everybody,

I want to convert some Amiga based IFF files to GIF, but the files seems unknown to then most convention programs under Windows .  

Please help me to convert the files .

http://rapidshare.com/files/68321925/SEBP_sheet1
http://rapidshare.com/files/68322101/SEBP_sheet2
http://rapidshare.com/files/68322262/SEBP_sheet3
http://rapidshare.com/files/68322508/SEBP_sheet4
http://rapidshare.com/files/68322634/SEBP_sheet5

Regards,
Alex
Title: Re: Unknown IFF Format / Help me please !!!
Post by: Piru on November 10, 2007, 12:16:32 PM
The files are corrupt (chunks are shifted when they should be aligned). The corruption is from converting \n linefeeds to \r\n.

This can be undone manually but it needs some work (there can be \r\n sequence naturally in a binary file, so one needs to be careful not just replace all \r\n to \n globally).

If you transferred the files using CrossDos, make sure you don't have the linefeed conversion enabled when moving binary files. Also some combination of bogus mimetypes and certain browsers are known to result in such corruption.
Title: Re: Unknown IFF Format / Help me please !!!
Post by: Piru on November 10, 2007, 01:12:31 PM
Ok, here we go:
Code: [Select]
/*
  fix file corrupted by \n -> \r\n conversion

  NOTE: This program will convert all \r\n combinations. If such
  sequence occured in the original file it will be removed aswell.

  Written by Harry Sintonen <sintonen@iki.fi>
  Public Domain
*/

#include <stdio.h>
#include <stdlib.h>
#ifdef MSDOS
#include <fcntl.h>
#include <io.h>
#endif

#define RINGSIZE 2
#define CURR(x) ((x) % RINGSIZE)
#define PREV(x) (((x) - 1) % RINGSIZE)
#define NEXT(x) PREV(x)

int main(void)
{
  int c;
  unsigned char ring[RINGSIZE];
  int rindex = 0, windex = 0;
#ifdef MSDOS
  setmode(fileno(stdin), O_BINARY);
  setmode(fileno(stdout), O_BINARY);
#endif
  while ((c = getchar()) != EOF)
  {
    ring[CURR(windex++)] = c;
    if (windex - rindex == 2)
    {
      if (ring[CURR(rindex)] == '\r' &&
          ring[NEXT(rindex)] == '\n')
      {
        /* Skip this char */
        rindex++;
        continue;
      }
      putchar(ring[CURR(rindex++)]);
    }
  }
  /* Process remaining chars */
  while (CURR(rindex) != CURR(windex))
  {
    if (windex - rindex == 2 &&
        ring[CURR(rindex)] == '\r' &&
        ring[NEXT(rindex)] == '\n')
    {
      /* Skip this char */
      rindex++;
      continue;
    }
    putchar(ring[CURR(rindex++)]);
  }

  return EXIT_SUCCESS;
}

Code: [Select]
$ gcc -Wall -O2 fixlf.c -o fixlf
$ ./fixlf < SEBP_sheet1 | ilbmtoppm -verbose | pnmtopng - > SEBP_sheet1.png
ilbmtoppm: dimensions: 640x512, 2 planes
ilbmtoppm: compression: byterun1
ilbmtoppm: warning - non-square pixels; to fix do a 'pnmscale -yscale 1.1'
ilbmtoppm: unknown chunk type DPPS - skipping
ilbmtoppm: warning - probably shifted 4-bit colormap
ilbmtoppm:     use "-adjustcolors" to scale colormap to 8 bits
ilbmtoppm: input is a 2-plane ILBM
pnmtopng: 3 colors found

And the result:
(http://www.iki.fi/sintonen/temp/SEBP_sheet1.png)
Title: Re: Unknown IFF Format / Help me please !!!
Post by: Piru on November 10, 2007, 01:13:29 PM
Here are the rest:
(http://www.iki.fi/sintonen/temp/SEBP_sheet2.png)
(http://www.iki.fi/sintonen/temp/SEBP_sheet3.png)
(http://www.iki.fi/sintonen/temp/SEBP_sheet4.png)
(http://www.iki.fi/sintonen/temp/SEBP_sheet5.png)
Title: Re: Unknown IFF Format / Help me please !!!
Post by: maxmania on November 10, 2007, 09:09:57 PM
Piru , Thank you very much my friend for convention of the files  and Technical Info.
I sent a private message to you , please read it.
Title: Re: Unknown IFF Format / Help me please !!!
Post by: jmbattle on November 11, 2007, 12:41:27 AM
What a lovely chap.

Take care,
James
x