Post

Replies

Boosts

Views

Activity

Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
Second attempt to paste code: int CDib_ARGB::Load(LPCSTR pFilename) { int rc = 0; if (NULL == m_pRaw_vImage_Buffer) { NSString *pNS_filename = [[NSString alloc]initWithUTF8String:pFilename]; NSImage *pNSImage = [[NSImage alloc] initWithContentsOfFile:pNS_filename]; if (nil == pNSImage) rc = -1; else { int width = pNSImage.size.width; int height = pNSImage.size.height; if (pNSImage.representations) { NSImageRep *imageRep; int jj; width = 0; height = 0; for (jj = 0; jj < pNSImage.representations.count; jj++) { imageRep = pNSImage.representations[jj]; if (imageRep.pixelsWide > width) width = imageRep.pixelsWide; if (imageRep.pixelsHigh > height) height = imageRep.pixelsHigh; } } NSSize imageSize = NSMakeSize(width, height); NSRect imageRect = NSMakeRect(0, 0, width, height); pNSImage.size = imageSize; CGImageRef cgImage = [pNSImage CGImageForProposedRect:&imageRect context:NULL hints:nil]; if (nil == cgImage) rc = -1;
Topic: Graphics & Games SubTopic: General Tags:
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
I am trying to paste from Xcode without much success. The dev forum tool is pretty awful. Is should not really matter though. The vImageBuffer_InitWithCGImage() call is pretty clear. I will try to attach a file with the code fragment. I note that the add file option does not let me add a file with a .mm extension. I will change it to .txt and see what happens. xdibARGB_fragment copy.txt
Topic: Graphics & Games SubTopic: General Tags:
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
Thank you for doing some testing. That is great. I am a little confused though. I uploaded the image file earlier on the thread. I have reuploaded for this reply. Its name is PXL_20251217_201630453.MP.jpeg . Note also that the sample code contained the line: format.bitmapInfo = kCGImageAlphaFirst | kCGBitmapByteOrderDefault;//ARGB8888 That is slightly different than what you tried. Note also that my code did not crash. vImageBuffer_InitWithCGImage returned with the error code kvImageInvalidParameter. A complete project to reproduce the error has been uploaded as a zip archive via Feedback Assistant. Feedback Assistant designates the report as FB21893783 . The jpeg file is also in the zip archive. Xcode debug console: -[MoeDocController openDocumentWithContentsOfURL:display:completionHandler:] file:///Users/elliotleonard/test/PXL_20251217_201630453.MP.jpeg fence tx observer 1f8eb timed out after 0.600000 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 cicp_tagFromColorSpace:57: Failed to get CICP info for space: <CGColorSpace 0xc0a66b0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 System Console when running Moe's Image Viewer with filter set to ‘Moe’: error 02:27:33.804783-0800 Moe's Image Viewer <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 default 02:27:33.830529-0800 Moe's Image Viewer CGImageGetTransformForOrientationAndSize Invalid orientation parameter
Topic: Graphics & Games SubTopic: General Tags:
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
I did some googling, and it was very suggestive: Reported Issues with vImage/Image Processing Unsupported File Formats: Some users have reported that vImageBuffer_InitWithCGImage may fail to properly initialize on certain image formats that were previously supported in Sonoma (macOS 14). Memory/Performance Errors: Reports of "out of memory" errors or failures to open specific image formats, even when file integrity is intact. Core Video/Image Misreports: In some cases, files are misreported as "unsupported file types" or "corrupted," particularly when dealing with newer HEIC/HEVC formats or specific raw file formats. Metadata Corruption: There have been reports of image metadata becoming corrupted after updating to newer macOS versions, which can trigger errors in apps relying on vImage. Potential Fixes and Workarounds If you are developing or using an app that utilizes vImage and it is failing on Sequoia: Check Chroma Siting: Ensure that the vImageCVImageFormat includes explicitly set chroma siting, as inconsistencies in Core Video format handling have been reported in newer frameworks. This is a full on disaster for my app. I do not seem to be able to load photos taken with a new Android Pixel 8 phone into my app. I need a bullet proof way to get these images into a vImageBuffer, ideally with an unpremultiplied ARGB pixel format. I may need some reliable default way to handle Chroma Siting, whatever the heck that is.
Topic: Graphics & Games SubTopic: General Tags:
3w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
Ok, I have found a workaround. See the attached text, which contains a routine that shows how to create a CGImage from the NSImage that vImageBuffer_InitWithCGImage can handle successfully for the problematic image files. Apparently vImageBuffer_InitWithCGImage is brittle and it needs for the CGImage to be rather vanilla which this rendering logic accomplishes. The files that cause failures are jpegs that came from an Android phone which feature color profiles that confuse vImageBuffer_InitWithCGImage. This new method seems to fix all the problems, fingers crossed. CGImageFromNSImage.txt
Topic: Graphics & Games SubTopic: General Tags:
2w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
Second attempt to paste code: int CDib_ARGB::Load(LPCSTR pFilename) { int rc = 0; if (NULL == m_pRaw_vImage_Buffer) { NSString *pNS_filename = [[NSString alloc]initWithUTF8String:pFilename]; NSImage *pNSImage = [[NSImage alloc] initWithContentsOfFile:pNS_filename]; if (nil == pNSImage) rc = -1; else { int width = pNSImage.size.width; int height = pNSImage.size.height; if (pNSImage.representations) { NSImageRep *imageRep; int jj; width = 0; height = 0; for (jj = 0; jj < pNSImage.representations.count; jj++) { imageRep = pNSImage.representations[jj]; if (imageRep.pixelsWide > width) width = imageRep.pixelsWide; if (imageRep.pixelsHigh > height) height = imageRep.pixelsHigh; } } NSSize imageSize = NSMakeSize(width, height); NSRect imageRect = NSMakeRect(0, 0, width, height); pNSImage.size = imageSize; CGImageRef cgImage = [pNSImage CGImageForProposedRect:&imageRect context:NULL hints:nil]; if (nil == cgImage) rc = -1;
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
I am trying to paste from Xcode without much success. The dev forum tool is pretty awful. Is should not really matter though. The vImageBuffer_InitWithCGImage() call is pretty clear. I will try to attach a file with the code fragment. I note that the add file option does not let me add a file with a .mm extension. I will change it to .txt and see what happens. xdibARGB_fragment copy.txt
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
The vImageBuffer_InitWithCGImage() call is pretty clear. I will try to attach a file with the code fragment. I note that the add file option does not let me add a file with a .mm extension. I will change it to .txt and see what happens. xdibARGB_fragment copy.txt
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
This the image file that causes the problem.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
Thank you for doing some testing. That is great. I am a little confused though. I uploaded the image file earlier on the thread. I have reuploaded for this reply. Its name is PXL_20251217_201630453.MP.jpeg . Note also that the sample code contained the line: format.bitmapInfo = kCGImageAlphaFirst | kCGBitmapByteOrderDefault;//ARGB8888 That is slightly different than what you tried. Note also that my code did not crash. vImageBuffer_InitWithCGImage returned with the error code kvImageInvalidParameter. A complete project to reproduce the error has been uploaded as a zip archive via Feedback Assistant. Feedback Assistant designates the report as FB21893783 . The jpeg file is also in the zip archive. Xcode debug console: -[MoeDocController openDocumentWithContentsOfURL:display:completionHandler:] file:///Users/elliotleonard/test/PXL_20251217_201630453.MP.jpeg fence tx observer 1f8eb timed out after 0.600000 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 cicp_tagFromColorSpace:57: Failed to get CICP info for space: <CGColorSpace 0xc0a66b0c0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1 <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 System Console when running Moe's Image Viewer with filter set to ‘Moe’: error 02:27:33.804783-0800 Moe's Image Viewer <<<< CMPhotoJFIFUtilities >>>> signalled err=-17102 at <>:1776 default 02:27:33.830529-0800 Moe's Image Viewer CGImageGetTransformForOrientationAndSize Invalid orientation parameter
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
4w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
vImageBuffer_InitWithCGImage returned with the error code kvImageInvalidImageFormat when I try to open the file PXL_20251217_201542944.MP.png in the test project. Unfortunately, that file is 8.7 megs(>5meg), so this tool will not let me upload it.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
3w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
I did some googling, and it was very suggestive: Reported Issues with vImage/Image Processing Unsupported File Formats: Some users have reported that vImageBuffer_InitWithCGImage may fail to properly initialize on certain image formats that were previously supported in Sonoma (macOS 14). Memory/Performance Errors: Reports of "out of memory" errors or failures to open specific image formats, even when file integrity is intact. Core Video/Image Misreports: In some cases, files are misreported as "unsupported file types" or "corrupted," particularly when dealing with newer HEIC/HEVC formats or specific raw file formats. Metadata Corruption: There have been reports of image metadata becoming corrupted after updating to newer macOS versions, which can trigger errors in apps relying on vImage. Potential Fixes and Workarounds If you are developing or using an app that utilizes vImage and it is failing on Sequoia: Check Chroma Siting: Ensure that the vImageCVImageFormat includes explicitly set chroma siting, as inconsistencies in Core Video format handling have been reported in newer frameworks. This is a full on disaster for my app. I do not seem to be able to load photos taken with a new Android Pixel 8 phone into my app. I need a bullet proof way to get these images into a vImageBuffer, ideally with an unpremultiplied ARGB pixel format. I may need some reliable default way to handle Chroma Siting, whatever the heck that is.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
3w
Reply to vImageBuffer_InitWithCGImage fails with Xcode 26 but succeeds with Xcode 15I am
Ok, I have found a workaround. See the attached text, which contains a routine that shows how to create a CGImage from the NSImage that vImageBuffer_InitWithCGImage can handle successfully for the problematic image files. Apparently vImageBuffer_InitWithCGImage is brittle and it needs for the CGImage to be rather vanilla which this rendering logic accomplishes. The files that cause failures are jpegs that came from an Android phone which feature color profiles that confuse vImageBuffer_InitWithCGImage. This new method seems to fix all the problems, fingers crossed. CGImageFromNSImage.txt
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
2w