display jpeg2000 in ios 4.3
I am using IOS sdk 4.3
I want to use jpeg200 images in my project and want to display it .
Would anyone help me?
Thanks.
iPad, iOS 4.3
Apple Event: May 7th at 7 am PT
I am using IOS sdk 4.3
I want to use jpeg200 images in my project and want to display it .
Would anyone help me?
Thanks.
iPad, iOS 4.3
JPEG 2000 is already supported.
JPEG 2000 is already supported.
I read the documents and try to retrive image from a jp2 file.I used the code written below
CGImageRef img=[self MyCreateCGImageFromFile:@"/Users/pacs/Desktop/JP2Files/a1.jp2"];
- (CGImageRef) MyCreateCGImageFromFile 😟NSString *) path
{
// Get the URL for the pathname passed to the function.
NSURL *url = [NSURL fileURLWithPath:path];
CGImageRef myImage = NULL;
CGImageSourceRef myImageSource;
CFDictionaryRef myOptions = NULL;
CFStringRef myKeys[2];
CFTypeRef myValues[2];
// Set up options if you want them. The options here are for
// caching the image in a decoded form and for using floating-point
// values if the image format supports them.
myKeys[0] = kCGImageSourceShouldCache;
myValues[0] = (CFTypeRef)kCFBooleanTrue;
myKeys[1] = kCGImageSourceShouldAllowFloat;
myValues[1] = (CFTypeRef)kCFBooleanTrue;
// Create the dictionary
myOptions = CFDictionaryCreate(NULL, (const void **) myKeys,
(const void **) myValues,
2,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
// Create an image source from the URL.
myImageSource = CGImageSourceCreateWithURL((CFURLRef)url, myOptions);
if (myImageSource == NULL)
{
fprintf(stderr, "Image source is NULL.");
return NULL;
}
// Create an image from the first item in the image source.
myImage = CGImageSourceCreateImageAtIndex(myImageSource,
0,
NULL);
// CFRelease(myImageSource);
// Make sure the image exists before continuing
if (myImage == NULL)
{
fprintf(stderr, "Image not created from image source.");
return NULL;
}
return myImage;
}
But it is showing --Image not created from image source
I am not able to know where the error is .
Would you please hepl me ?
I took the IKImageViewDemo project, added your code to setup myOptions, and it worked fine. Is your image file valid? Can you open it in Preview?
The image source is valid one.
In Mac it is working fine. But I want to display jp2 in iOS-SDK .
I tried to use the same code of IKImageViewDemoproject in ios-project but showing that image is null or not created .
I need to view jpeg2000 images with out converting it to any other format .
Is there any way ?
Or is rthere like that ios5 can view jpeg2000 images ?
You can use either of those libraries I mentioned above to read JPEG2000. You will have to read the data into memory and then move that memory into a Core Graphics structure. It isn't trivial but it isn't impossible either.
The images support in xcode 4.2 and ios5 are
<CFArray 0x6e30580 [0x1337b38]>{type = mutable-small, count = 36, values = (
0 : <CFString 0x2741e0 [0x1337b38]>{contents = "public.png"}
1 : <CFString 0x2741c0 [0x1337b38]>{contents = "public.jpeg"}
2 : <CFString 0x274280 [0x1337b38]>{contents = "com.compuserve.gif"}
3 : <CFString 0xe24e9f4 [0x1337b38]>{contents = "com.canon.tif-raw-image"}
4 : <CFString 0xe24ec04 [0x1337b38]>{contents = "com.adobe.raw-image"}
5 : <CFString 0xe24e954 [0x1337b38]>{contents = "com.canon.cr2-raw-image"}
6 : <CFString 0xe24ebf4 [0x1337b38]>{contents = "com.leafamerica.raw-image"}
7 : <CFString 0xe24ec14 [0x1337b38]>{contents = "com.hasselblad.fff-raw-image"}
8 : <CFString 0xe24ec24 [0x1337b38]>{contents = "com.hasselblad.3fr-raw-image"}
9 : <CFString 0xe24fb34 [0x1337b38]>{contents = "com.nikon.raw-image"}
10 : <CFString 0xe24fb44 [0x1337b38]>{contents = "com.nikon.nrw-raw-image"}
11 : <CFString 0xe24eaa4 [0x1337b38]>{contents = "com.pentax.raw-image"}
12 : <CFString 0xe24fb54 [0x1337b38]>{contents = "com.samsung.raw-image"}
13 : <CFString 0xe24ea94 [0x1337b38]>{contents = "com.sony.raw-image"}
14 : <CFString 0xe24faa4 [0x1337b38]>{contents = "com.sony.sr2-raw-image"}
15 : <CFString 0xe24ea84 [0x1337b38]>{contents = "com.sony.arw-raw-image"}
16 : <CFString 0xe24fb24 [0x1337b38]>{contents = "com.epson.raw-image"}
17 : <CFString 0xe24ec34 [0x1337b38]>{contents = "com.kodak.raw-image"}
18 : <CFString 0x2738e0 [0x1337b38]>{contents = "public.tiff"}
19 : <CFString 0x2742a0 [0x1337b38]>{contents = "com.microsoft.ico"}
20 : <CFString 0x2742c0 [0x1337b38]>{contents = "com.microsoft.bmp"}
21 : <CFString 0x274200 [0x1337b38]>{contents = "public.xbitmap-image"}
22 : <CFString 0x2742b0 [0x1337b38]>{contents = "com.microsoft.cur"}
23 : <CFString 0x2742e0 [0x1337b38]>{contents = "com.truevision.tga-image"}
24 : <CFString 0x2741d0 [0x1337b38]>{contents = "public.jpeg-2000"}
25 : <CFString 0x2741c0 [0x1337b38]>{contents = "public.jpeg"}
26 : <CFString 0xe24ea74 [0x1337b38]>{contents = "com.canon.crw-raw-image"}
27 : <CFString 0xe24e9e4 [0x1337b38]>{contents = "com.fuji.raw-image"}
28 : <CFString 0xe24e9a4 [0x1337b38]>{contents = "com.panasonic.raw-image"}
29 : <CFString 0xe24e9b4 [0x1337b38]>{contents = "com.panasonic.rw2-raw-image"}
30 : <CFString 0xe24e9c4 [0x1337b38]>{contents = "com.leica.raw-image"}
31 : <CFString 0xe24e9d4 [0x1337b38]>{contents = "com.leica.rwl-raw-image"}
32 : <CFString 0xe24e964 [0x1337b38]>{contents = "com.konicaminolta.raw-image"}
33 : <CFString 0xe24e994 [0x1337b38]>{contents = "com.olympus.sr-raw-image"}
34 : <CFString 0xe24e984 [0x1337b38]>{contents = "com.olympus.or-raw-image"}
35 : <CFString 0xe24e974 [0x1337b38]>{contents = "com.olympus.raw-image"}
)}
<CFArray 0x6a2ca80 [0x1337b38]>{type = mutable-small, count = 9, values = (
0 : <CFString 0x2741e0 [0x1337b38]>{contents = "public.png"}
1 : <CFString 0x2741c0 [0x1337b38]>{contents = "public.jpeg"}
2 : <CFString 0x274280 [0x1337b38]>{contents = "com.compuserve.gif"}
3 : <CFString 0x2738e0 [0x1337b38]>{contents = "public.tiff"}
4 : <CFString 0x2742a0 [0x1337b38]>{contents = "com.microsoft.ico"}
5 : <CFString 0x2742c0 [0x1337b38]>{contents = "com.microsoft.bmp"}
6 : <CFString 0x274250 [0x1337b38]>{contents = "com.adobe.pdf"}
7 : <CFString 0x2742e0 [0x1337b38]>{contents = "com.truevision.tga-image"}
8 : <CFString 0x2741d0 [0x1337b38]>{contents = "public.jpeg-2000"}
)}
I think ios 5 can display jpeg2000 images without adding any extra library.
Well, you are the one who reported it didn't work. The documentation says it shouldn't. Some random metadata file might not mean much if you can't get it working.
Thanks.
I am able to view JPEG2000 images using xcode4.2 and ios_sdk_5 without using any extra libraries.
JPEG 2000 should work fine if they are running IOS 5.x
Yaa
display jpeg2000 in ios 4.3