To and modify the "Downloaded image has 0 pixels" error exits bug download a file of the png format
This commit is contained in:
parent
469d8bbfd8
commit
32ca18b523
|
@ -33,9 +33,6 @@
|
||||||
|
|
||||||
if (anyAlpha) { return image; }
|
if (anyAlpha) { return image; }
|
||||||
|
|
||||||
size_t width = CGImageGetWidth(imageRef);
|
|
||||||
size_t height = CGImageGetHeight(imageRef);
|
|
||||||
|
|
||||||
// current
|
// current
|
||||||
CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(CGImageGetColorSpace(imageRef));
|
CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(CGImageGetColorSpace(imageRef));
|
||||||
CGColorSpaceRef colorspaceRef = CGImageGetColorSpace(imageRef);
|
CGColorSpaceRef colorspaceRef = CGImageGetColorSpace(imageRef);
|
||||||
|
@ -44,10 +41,17 @@
|
||||||
if (unsupportedColorSpace)
|
if (unsupportedColorSpace)
|
||||||
colorspaceRef = CGColorSpaceCreateDeviceRGB();
|
colorspaceRef = CGColorSpaceCreateDeviceRGB();
|
||||||
|
|
||||||
CGContextRef context = CGBitmapContextCreate(NULL, width,
|
size_t width = CGImageGetWidth(imageRef);
|
||||||
|
size_t height = CGImageGetHeight(imageRef);
|
||||||
|
NSUInteger bytesPerPixel = 4;
|
||||||
|
NSUInteger bytesPerRow = bytesPerPixel * width;
|
||||||
|
NSUInteger bitsPerComponent = 8;
|
||||||
|
|
||||||
|
CGContextRef context = CGBitmapContextCreate(NULL,
|
||||||
|
width,
|
||||||
height,
|
height,
|
||||||
CGImageGetBitsPerComponent(imageRef),
|
bitsPerComponent,
|
||||||
0,
|
bytesPerRow,
|
||||||
colorspaceRef,
|
colorspaceRef,
|
||||||
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
|
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue