0

When I save the image to the album, it failed.

error info: PEG Application transferred too few scanlines

Anyone has ever met this? Thanks.

// make data provider with data.
Float32 picSize = texture->image_size.width * texture->image_size.height * texture->bytesPerPixel;
NSLog(@"pic size:%f", picSize);
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, texture->data, texture->image_size.width * texture->image_size.height * texture->bytesPerPixel, NULL);

// prep the ingredients
int bitsPerComponent = 8;
int bitsPerPixel = 32;
int bytesPerRow = 4 * 320;
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;

// make the cgimage
CGImageRef imageRef = CGImageCreate(320, 480, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent);

// then make the uiimage from that
UIImage *myImage = [UIImage imageWithCGImage:imageRef];
UIImageWriteToSavedPhotosAlbum(myImage, self, nil, nil);
alexqinbj
  • 1,091
  • 3
  • 13
  • 27
  • hey look similar thread. have you seen this ? .this thread references same problem in detail. [go through this link](https://stackoverflow.com/questions/5081297/ios-uiimagejpegrepresentation-error-not-a-jpeg-file-starts-with-0xff-0xd9) – Kamar Shad May 21 '13 at 08:00
  • I have seen this before. The difference is I do not have a path, only I have is a point of picture address. – alexqinbj May 21 '13 at 08:10

1 Answers1

0

I encountered a similar Error message when I was feeding a Greyscale image to a program that expected it to be TrueColor

Sofox
  • 5,088
  • 1
  • 19
  • 10