AttachedPictureFrame

aguion alex at orb.com
Wed Jul 26 20:35:50 CEST 2006


Hi,

I get a hard time trying to get the data of an attached picture. Even if I
just copy the data received directly to a file, the image is screwed up.
Here's my code :

frameList = id3v2Tag->frameListMap()["APIC"];
if(!frameList.isEmpty()) {
   TagLib::ID3v2::AttachedPictureFrame * pic =
static_cast<TagLib::ID3v2::AttachedPictureFrame *> (frameList.front());
    if (pic) {
      // embedded thumbnail
      CStringW mimetype = pic->mimeType().toCString();
    
      int fdout;
     
if((fdout=_topen(_T("C:\\tmp.jpg"),_O_CREAT|_O_WRONLY|_O_BINARY|_O_TRUNC,
_S_IWRITE))<0)
      {		
         //_close(fdout);
         return 1;
      }
      int bytesWrote = _write(fdout,pic->picture().data(),pic->size() *
(sizeof(unsigned char)));
     _close(fdout);
}


 If I change the writing of the file to be non binary, the data seem to be
better (a simple comparison of this file and the real picture shows that
half of the data are the same).
Do you have any idea what am I doing wrong ?
and why would a static_cast help me better than a simple cast (I saw the
static_cast on previous posts, didn't help me that much) ?

THanks for your answer

Alex
-- 
View this message in context: http://www.nabble.com/AttachedPictureFrame-tf2005426.html#a5508692
Sent from the taglib-devel forum at Nabble.com.



More information about the taglib-devel mailing list