I'm trying to parse the mobi books, only want to get some information of the book, ie: title, author and cover (if any). I'm following mobi format spec.
Now, I can get the title and author correctly, but when it comes to the cover, I get these information so far:
I get the image record block index:
108 0x6c 4 First Image index First record number (starting with 0) that contains an image. Image records should be sequential.
I get the offset from the beginning to the image record
- I tried to get these fields, but I got none of them from any of my books:
EXTH 201 4 coveroffset Add to first image field in Mobi Header to find PDB record containing the cover image <EmbeddedCover> 202 4 thumboffset Add to first image field in Mobi Header to find PDB record containing the thumbnail cover image 203 hasfakecover
SO, Now I have gotten a raw binary block, I compared it with other png file and jpg files, see nothing in common. I also attempted to save this binary block to a test.png or test.jpg, but it seems not a real image.
what shall I do?
I can perfectly save my first image_record_block as jpg. And because they are compressed images they wont be subjected to mobi or palmdoc compression You should open raw file in text editor and see if that is really any of image format. This can be either you are hoping wrong index number or file pointer is not in correct offset, try to use fseek()