rjyo/libid3-ios

Not really an issue but please help

Closed this issue · 2 comments

Hi Jyo i was a bit stuck with your ios port of libid3 as im tryin to write a cover image but cant find out the correct way and i've been at it for a while so i hope you done mind below is what i have from the example Please help
ID3_Frame frame4;
frame4.SetID(ID3FID_PICTURE);
frame4.GetField(ID3FN_DATA)->Set(ID3TE_UNICODE);
UIImage *newImage = [UIImage imageNamed:@"amazing-grace.jpg"];
frame4.GetField(ID3FN_DATA)->Set[ newImage]); ///struggling with this line to set the nImage as the mp3 cover art

rjyo commented

I only tried to write song name and other text info. As UIImage is only available to iOS, I guess you need to use other data format.

NSData imageData = UIImageJPEGRepresentation(image, 0.90);
uchar *dataBytes = (uchar
)[imageData bytes];
frame4.GetField(ID3FN_DATA)->Set(dataBytes, imageData.length);