Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread John Joyce
On Jun 28, 2011, at 7:14 PM, Jens Alfke wrote: > > On Jun 28, 2011, at 4:53 PM, James Merkel wrote: > >>> Synalyzeit is a free hex editor that's fabulous. >> >> Thanks, I'll take a look at that. HexEdit is getting a little dated. > > Hex Fiend (open source) is nice too

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 4:53 PM, James Merkel wrote: >> Synalyzeit is a free hex editor that's fabulous. > > Thanks, I'll take a look at that. HexEdit is getting a little dated. Hex Fiend (open source) is nice too —Jens smime.p7s Description: S/MIME cryptogra

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread James Merkel
On Jun 28, 2011, at 4:35 PM, John Joyce wrote: On Jun 28, 2011, at 6:18 PM, James Merkel wrote: Kevin, As others have suggested you probably want to step down to more basic C coding to handle this task. You can just use C library functions to read data from the file: fopen(), fseek(),

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread John Joyce
On Jun 28, 2011, at 6:18 PM, James Merkel wrote: > Kevin, > > As others have suggested you probably want to step down to more basic C > coding to handle this task. > You can just use C library functions to read data from the file: fopen(), > fseek(), fread(), fgetc(), fclose() etc. as discus

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread James Merkel
Kevin, As others have suggested you probably want to step down to more basic C coding to handle this task. You can just use C library functions to read data from the file: fopen(), fseek(), fread(), fgetc(), fclose() etc. as discussed in Kernighan and Ritchie. As far as big endian, litt

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Francis Devereux
On 28 Jun 2011, at 18:00, Jens Alfke wrote: > Another way (that I often use) is to define a C struct that matches the > fields and layout of the header, then cast the bytes to a pointer to that > struct and read the fields. It makes your code look a lot cleaner, but you > have to be careful to

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Charles Srstka
On Jun 28, 2011, at 2:57 PM, Thomas Engelmeier wrote: > - the endian issue you'll have to deal with anyway Yes, that was the point. You already have to go through the struct member by member and fix the endians anyway, so reading the whole thing in as one block of data won’t actually make your

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Thomas Engelmeier
On 28.06.2011, at 21:57, Thomas Engelmeier wrote: > > On 28.06.2011, at 21:37, Charles Srstka wrote: > >> On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: >> >>> Another way (that I often use) is to define a C struct that matches the >>> fields and layout of the header, then cast the bytes to

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Thomas Engelmeier
On 28.06.2011, at 21:37, Charles Srstka wrote: > On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: > >> Another way (that I often use) is to define a C struct that matches the >> fields and layout of the header, then cast the bytes to a pointer to that >> struct and read the fields. It makes you

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Thomas Engelmeier
On 28.06.2011, at 15:23, Kevin Muldoon wrote: > Was writing a program to create thumbnails using SIPS, GhostScript, > ImageMagick. During testing I found I needed to read the header file of Adobe > Photoshop native documents directly because Duotone image color mode simply > wasn't returning t

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Charles Srstka
On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: > Another way (that I often use) is to define a C struct that matches the > fields and layout of the header, then cast the bytes to a pointer to that > struct and read the fields. It makes your code look a lot cleaner, but you > have to be careful

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Stephen Hoffman
On 28 Jun 2011 10:00:51 -0700, Jens Alfke posited: > Assuming Œversion‚ is a 16-bit big-endian integer, you could read it like > this: The htons() and ntohs() C calls go from host-native integer (short) format to network format (big-endian), and from network format back to host-native short

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Kevin Muldoon
No problem at all. I'll pick up Kernighan & Ritchie. Thanks for reply. On Jun 28, 2011, at 1:17 PM, Jens Alfke wrote: On Jun 28, 2011, at 10:11 AM, Kevin Muldoon wrote: I suppose the trouble here is that I'm familiar with Objective-C code and not so familiar with its parent, C. Yeah, unfo

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 10:11 AM, Kevin Muldoon wrote: > I suppose the trouble here is that I'm familiar with Objective-C code and not > so familiar with its parent, C. Yeah, unfortunately Objective-C does not absolve you of having to know C. With where you’re going, I’d suggest cracking open Ker

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Kevin Muldoon
Hey Jens, I suppose the trouble here is that I'm familiar with Objective-C code and not so familiar with its parent, C. On Jun 28, 2011, at 1:00 PM, Jens Alfke wrote: On Jun 28, 2011, at 6:23 AM, Kevin Muldoon wrote: As you can see from the output, the 'version' & 'reserved' isn't being

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 6:23 AM, Kevin Muldoon wrote: > As you can see from the output, the 'version' & 'reserved' isn't being read > at all. Must I coerce/parse something here? Much thanks… I’m not familiar with the PSD format, but aren’t ‘version’ and ‘reserved’ binary? You’re printing them as C

Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Kevin Muldoon
Was writing a program to create thumbnails using SIPS, GhostScript, ImageMagick. During testing I found I needed to read the header file of Adobe Photoshop native documents directly because Duotone image color mode simply wasn't returning the proper color mode (in a variety of programs).