Deepzoom images: starting image quality - image-processing

I am working on implementing a zoomable image viewer using OpenSeadragon and deep zoom images. I used the VIPS command line tool to create DZI files. My question is, does the original image used to create DZI files need to meet specific requirements to make it zoomable? (like format, size, etc.) If a normal .jpg image is converted to DZI, it seems like the image will not be zoomable. Is this correct?

My question is, does the original image used to create DZI files need to meet specific requirements to make it zoomable?
No, except to have a resolution higher than the screen resolution (in that case, the original image can be displayed directly).

Related

What are the ways to reduce bundle size on iOS?

I have some images which are huge in size and my bundle size currently is 70 MB. I think Xcode already runs the assets through png crush.
Do not use any text images with useless effects, use UILabels instead.
Draw simple shapes and effects using CAShapeLayers instead of using
images.
Use JPEGs instead of PNGs where you don't need transparency.
(Actually file size depends on the image content here)
Use Save for Web option in PhotoShop or other tools to optimize PNG
images.
Use sprites combined together instead of separate images.
Make sure you delete all unused resources.
Do not localize common parts of the images, localize only the
different parts. (think of a background image with a small flag at
the bottom for each locale. use one single bg image and separate flag
images. localize flag images only, not the entire bg images with the
flags.)
Use the same splash images for iOS7 and previous iOS versions. (You
need to manually edit the JSON file in .xcassets)
Try using a CDN to download assets on the first launch.
In addition to images keep those in mind too:
Try replacing custom fonts with default system fonts if you don't
need them really.
Use MP3 audio files instead of WAV files. (or other
compressed formats)
Make sure you delete all unused 3rd party frameworks.
You can try converting the images to jpg (if they don't have any transparent regions).
Also try using http://imageoptim.com/
It seems very unlikely that you actually need huge images. After all, the screen is not huge. Thus, the most likely form of size reduction is to reduce the physical dimensions of the images to the size you are actually going to be displaying.
This saves bandwidth when the user downloads the image, reduces the size of the app on the user's hard disk (the device), and also saves memory at the time an image is loaded. It is a vast waste of RAM to load an image that is larger than the size at which it will be displayed; after all, remember, the memory involved rises exponentially with the square of the difference.
One option is to host the images on a CDN like OpenText and fetch them as part of app initialization, or whenever they are first needed. Obviously this is more coding, but projects like SDWebImage make it pretty easy:
https://github.com/rs/SDWebImage/tree/master/SDWebImage
It also gives you the flexibility to swap out those images later if you use caching headers.

How can I generate iOS code to draw an image?

How can I consume a graphic and then generate objective-c code that can draw it? The code generation doesn't need to be written in objective-c, but must generate objective-c code.
Input: A.png
Output: Core Graphics code to generate a file A.png that would match the image of the original file, A.png.
For example, since I can find out the color and position of every pixel, what tool can I use to write iOS code that draws those pixels exactly.
Why inflate the bundle size with images or why wait to pull down images from a web service when the app itself could generate those images with the right instructions.
My intention is to use this in a white label solution.
Why inflate the bundle size with images or why wait to pull down images from a web service when the app itself could generate those images with the right instructions
Because your code will still need to contain all the information contained in the image, plus all those drawing instructions, so you're going to end up with a larger product, not a smaller one. Additionally, building the image data into the code makes it that much harder to change.
Use PaintCode to create your graphics.
You are done.

How to get rid of empty transparent areas in a PNG image so that it conforms to actual image size?

I have a series of images that I would look to loop through using iOS's [UIView startAnimating]. My trouble is that, when I exported the images, they all came standard in a 240x160 size, although only 50x50 contains the actual image, the rest being transparent parts that are just taking up space.
When I set the frame of the image automatically using image.size.width and image.size.height, iOS takes into images' original size of 240x160, so I am unable to get a frame that conforms to the actual parts of the image. I was wondering if there is a way using Illustrator or Photoshop, or any other graphics editing software for me to export the images based on their natural dimensions, and not a fixed dimension. Thanks!
I am a fan of vector graphics and thinks everything in the world should be vector ;-) so here is what you do in illustrator: file - document setup - edit artboards. Then click on the image, and the artboard should adjust to the exact size. You can of course have multiple artboards, or simply operate with one artboard and however-many images.

Use icns file as an image in iOS

Is there a way to use an icns file as the image source for I guess a UIImage? Or pick out one of the representations and resize?
NSImage does not seem to be available in cocoa-touch.
In particular I'd like to use them for drawing in the imageView part of a UITableViewCell.
There is no built-in way to do this and I see little benefit in doing so. It's best to just use the sizes that you need and ship them as individual images in your app. If you want to draw the images in a UITableViewCell, performance is an important aspect and resizing images won't be fast.
If you really need images in many different sizes and really don't want the best performance by including images for each size, you could use a PDF to make use of vector graphics. There is a nice article about this technique: http://mattgemmell.com/2012/02/10/using-pdf-images-in-ios-apps/
Honestly, don't try to use .icns files in your iOS app. It's just a container for images of different sizes and resizing is not a good idea, anyway. Either include individual images for any size you need or use vector graphics using a PDF file.

Custom PhotoLibrary, and jpeg compression

I have to create a custom photolib like the default one, with animation etc. I had some doubts..
1. Doubt
Should I create 3 images (Thumbnail image, 320*480 image to display full image and original size image in case user share the image) (I am storing this all in app doc directory)
Or should I only store the original image and crop them wen required in 2 other images? In this case, if I use scroll view to display cropped images, how do I know what the user is seeing? And when do I crop next images to keep them ready to display?
(Can anything like reusable cells be created here like in tableview? If yes, can you give me some idea?)
Also, I am fetching images from doc directory. In this case should I load all images in Array or load in batches?
2. Problem Major:
Also need to compress original image and keep it of same size (I used uijpegrepresentation with compression ratio but with some jpegs after compression. It increases sizes even double the size).
You can use single image and for thumbnail you can Resize at run time else it increase size and performance issue. there is lots of open source library are there which do same what you needed. Please have a look below.
https://github.com/arturgrigor/AGImagePickerController
https://github.com/gdavis/FGallery-iPhone

Resources