Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a better way for tiling Images in iphone
    primarykey
    data
    text
    <p>Currently, trying to download the images through URLs and tiling those images in the way of how PhotoScroller app has been done by Apple store. The largest image size is 4000 * 4000 and is in RGB format. I am tiling those images with tilesize 256 * 256. It takes a very long time to tile the image and write the files on the disk. Was looking for a better approach if its possible to tile the files and load on iphone. Total of 4 URL calls and each URL call fetches an image and passes through tiling process and calls PhotoScroller app to launch those images on iphone.</p> <p>If anyone has come across such issues and know more about it, can you share some ideas.</p> <pre><code>-(void) startImageDownloading { if (!isImageRequested) { isImageRequested = YES; self.responseData = [NSMutableData data]; URL1 = @"http://www.abc.com/image_id=1&amp;size=1"; NSURLRequest *request1 = [NSURLRequest requestWithURL:[NSURL URLWithString:URL1]]; self.connection1= [[[NSURLConnection alloc] initWithRequest:request1 delegate:self] autorelease]; URL2 = @"http://www.abc.com/image_id=2&amp;size=2"; NSURLRequest *request2 = [NSURLRequest requestWithURL:[NSURL URLWithString:URL2]]; self.connection2= [[[NSURLConnection alloc] initWithRequest:request2 delegate:self] autorelease]; URL3 = @"http://www.abc.com/image_id=3&amp;size=3"; NSURLRequest *request3 = [NSURLRequest requestWithURL:[NSURL URLWithString:URL3]]; self.connection3= [[[NSURLConnection alloc] initWithRequest:request3 delegate:self] autorelease]; URL4 = @"http://www.abc.com/image_id=4&amp;size=4"; NSURLRequest *request4 = [NSURLRequest requestWithURL:[NSURL URLWithString:URL4]]; self.connection4= [[[NSURLConnection alloc] initWithRequest:request4 delegate:self] autorelease]; } } - (void)saveTilesOfSize:(CGSize)size forImage:(UIImage*)image toDirectory:(NSString*)directoryPath usingPrefix:(NSString*)prefix { CGFloat cols = [image size].width / size.width; CGFloat rows = [image size].height / size.height; int fullColumns = floorf(cols); int fullRows = floorf(rows); CGFloat remainderWidth = [image size].width - (fullColumns * size.width); CGFloat remainderHeight = [image size].height - (fullRows * size.height); if (cols &gt; fullColumns) fullColumns++; if (rows &gt; fullRows) fullRows++; CGImageRef fullImage = [image CGImage]; for (int y = 0; y &lt; fullRows; ++y) { for (int x = 0; x &lt; fullColumns; ++x) { CGSize tileSize = size; if (x + 1 == fullColumns &amp;&amp; remainderWidth &gt; 0) { // Last column tileSize.width = remainderWidth; } if (y + 1 == fullRows &amp;&amp; remainderHeight &gt; 0) { // Last row tileSize.height = remainderHeight; } CGImageRef tileImage = CGImageCreateWithImageInRect(fullImage,(CGRect){{x*size.width, y*size.height},tileSize}); NSData *imageData = UIImagePNGRepresentation([UIImage imageWithCGImage:tileImage]); CGImageRelease(tileImage); NSString *path = [NSString stringWithFormat:@"%@/%@%d_%d.png",directoryPath, prefix, x, y]; [imageData writeToFile:path atomically:NO]; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload