0
이미지를 한 형식 (.png)에서 다른 이미지 형식 (.img 형식)으로 변환하고 싶습니다. 동일한 이미지 형식에 대해 rgba 값을 검색하고 수정할 수있었습니다. 다른 이미지 형식으로 변환해야하는 추가 작업이 있습니까?iOS에서 새 비트 맵을 만들고 검색하는 방법
비어있는 비트 맵을 만들었으므로이 비트 맵 이미지를 그릴 수 있습니다.
CGImageRef cgimage = image.CGImage;
size_t width = CGImageGetWidth(cgimage);
size_t height = CGImageGetHeight(cgimage);
size_t bytesPerRow = CGImageGetBytesPerRow(cgimage);
size_t bytesPerPixel = CGImageGetBitsPerPixel(cgimage);
size_t bitsPerComponent = CGImageGetBitsPerComponent(cgimage);
size_t bytes_per_pixel = bytesPerPixel/bitsPerComponent;
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(cgimage);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
unsigned char *rawData = malloc(height * width * 4);
memset(rawData, 0, height * width * 4);
CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.CGImage);
수정 된 rgba 값으로 출력 비트 맵을 채우는 기능이 iOS에 있습니까?
"iOS에서 비트 맵으로 데이터를 그리는 방법"이란 무엇을 의미합니까? 특정 지점에서 픽셀을 선택하는 것에 대해 이야기하고 있습니까? –
@TBlue : 제목을 수정했습니다. – Ram
더 많이 읽을수록 혼란스러워집니다. 귀하가 지시하는 확장자 중 하나 (.img)는 10 년 전이나 디스크 이미지 형식으로 사용되었습니다. –