iOS Photo Library - image orientation change - rotation

How can I change orientation property (to avoid re-encoding upon rotation) on image stored in iOS Photo Library ?
I was trying to search for corresponding method or propery on PHAsset (where I'd expect it), but with no luck.

Related

Xlsxwriter rotate image

I am downloading a number of images to my local drive then adding them to a spreadsheet using insert_image(). The images are correctly oriented in Windows Explorer and other image viewing apps. However when I add an image (portrait) to the spreadsheet it becomes rotated to landscape. Landscape images do not appear to be rotated.
I also have a URL link for each image. When I click the image it opens up in a viewer in the correct orientation. It appears as if the insert_image is not respecting the image orientation. The EXIF information does not contain orientation.
Is there a way to specify image orientation, or rotate the image before inserting?
Thanks in advance,
Ian
Thanks for your help. That does seem to be the behaviour. xlsxwriter insert images in the ‘raw’ orientation of the image.
I was trying to insert images which have exif information, where all image are captured in the same orientation - in supported viewers exif flag is used in to rotate the image to the way the camera was oriented when taking the photo. I have solved the problem by applying the rotation to the image before inserting it into excel using xlsxwriter.

Set background image compatible for all iDevices

When creating background image for xCode project in Swift, and I also want it to be compatible for all iPhone and iPad devices, do I have to create it like i created the app icon? With all the #2x names, or do i only need 1 image?
And what size should the image be?
Since XCode 6 it's possible to use vector based graphics. This gives you the opportunity to create one vector graphic and during compilation XCode creates the necessary PNGs for iOS (actually iOS 8 does not have full support for vector based graphics).
I use Sketch 3 for creating and working with assets, so there you can create an icon (or whatever) and export it as pdf (Note you have to choose 0.5x, because this is handled in XCode as the smallest icon).
For the sizes of app icons check apple documentation, else you just use the size your imageView is
What size should the image be?
The size of your images depends on how large they are on screen. For example, say you have a UIImageView that has as width and height of 100 points:
On an iPad 2 (which doesn't have a retina display) you would be
using a 1x image and so your image file would be 100x100 pixels.
On an iPhone 5 (which uses a 2x retina display) your image file would need to be 200x200 pixels.
On an iPhone 6+ (which uses a 3x display) your image file would need to be 300x300 pixels.
When creating background image for xCode project in Swift, and I also want it to be compatible for all iPhone and iPad devices, do I have to create it like i created the app icon? With all the #2x names, or do i only need 1 image?
You should have a look at Image Sets in Asset Catalogs.
From Apple:
Image sets: Used for most types of images, an image set contains all the versions, or representations, of an image that are necessary to support various devices and scale factors.
Here's some more information on them: https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html
To create one:
1. Create a new file. Then go to Resource and select Asset Catalog.
2. Press Next and give your catalog a name.
3. To add an Image Set, select your Asset Catalog (the .xcassets file). Then press the plus button in the bottom left hand corner and select New Image Set.
4. You can rename the the Image Set if you want, by default its name is 'Image'. This is the name you use to reference your image in code or IB.
5. Now you've got your image set you can drag and drop images into 1x, 2x or 3x. Or you can change the Devices (in the Attributes Editor) to Device Specific and select specific screen sizes for your images.
6. Now in your code you can create a UIImage using the following:
let image = UIImage(named: "Image")
// Just replace "Image" with the name of your image set.
You have to create them in different resolutions.
For more details you can have a look:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW2
You can find the right resolutions at the point: "Launch file or image"

I'm trying to clip an image overlay in Google Maps API

I'm trying to clip an image overlay in Google Maps API, however without success. I can clip a HTML image successfully and overlay it on a Google MAP by using the CSS clip property and z-index property, however that's no use, as the image does not adjust to the Google map zoom and movements. i.e. the image is not bound to the Google MAP object in any way, doesn't respond to map changes.
If I assign the Google Map overlay to the cropped image source, it simply uses the original un-cropped source and not the cropped page image element. That's just how the image.src property works.
I successfully added an image overlay for Google MAPS, but there does not seem to be any clipping or cropping function for them. There is text on the image that I don't want to display for this application, but I don't want to crop the original source file image, as it's used for multiple display purposes.
historicalOverlay = new google.maps.GroundOverlay(imageurl,imageBounds);
historicalOverlay.setMap(map);
I need imageurl to point to a clipped version in memory or something like that or the clipped form image element, but not its un-clipped source image. Any ideas ?
The GroundOverlay class in Google Maps javascript API V3 does not provide any support for in-browser clipping/cropping of the image before display.
Because we needed that capability, plus some others like image rotation and non-rectangular images, we wrote a GroundOverlayEX javascript class that supports everything that the Google Earth version of GroundOverlay supports, including browser-side clipping/cropping of the image to-be-displayed.
The javascript class is open-source on Github at: https://github.com/azmikemm/GroundOverlayEX. There is API documentation as well (documentation.txt). All images shown by the GroundOverlayEX class are integral to the map, and will drag with the map, and zoom with the map.
A working functional example of the class in-action (with some clipped/ cropped images) is at: https://sites.google.com/site/issearthatnight/
If you turn off the VIIRS checkbox, and set the transparency down to midway, you'll see the images pretty plainly, and see that some are cropped (all are stored in NASA's servers as rectangles, so images that are square-ish or look like slices have been cropped by the GroundOverlayEX class).

Image not assigning in Unity3d

I'm currently working on a puzzle game project in Unity3D and when I'm trying to assign a new image in script in the inspector view, it is still reading the old image by default. But the the field now has updated to new image name, and if I delete the old image, it is not showing up any image at all, just a gray color object.
What's wrong?
This is the image of the inspector view
The gray color means there is no image defined for that object. Try to make sure you have the reference to the image setup. Also try to reopen the scene to see the reflected changes.

how to set the IKImageBrowserView with variable cell sizes?

I am developing a tool which will allows the user to import the video clips and make the movie from those video clips.
To represent the imported video clips i have created the IKImageBrowserView and add the frameimage of the videoclip as a Thumbnail image. up to here everything is working.
But now i wanted to display the thumbnail image size based on the video clip duration. i.e each and every thumbnail image have the different size based on the duration. (i wanted to show the thumbnail image width going to be changed based on the duration of the video clip.
If i use [imageBrowser setCellSize:];then it will affect all the thumbnail sizes. but i wanted to apply different size for each and every thumbnail.
Can anybody help me to solve this problem?
if IKImageBrowserView is not the best suitable for my problem then please suggest me the best control to solve my problem.
The best solution will be implementing your own IKImageBrowserCell subclass for your custom IKImageBrowserView
First of all, you need to subclass the IKImageBrowserView and override newCellForRepresentedItem:
In this method, return an instance of your own subclass of IKImageBrowserCell.
In your subclass of IKImageBrowserCell, override the following methods to modify the layout dynamically based on the represented video clip:
(To retrive the video clip data model which should conform to the informal protocol, IKImageBrowserItem, use -[IKImageBrowserCell representedItem])
- (NSRect) imageContainerFrame;
- (NSRect) imageFrame;
- (NSRect) selectionFrame;
- (NSRect) titleFrame;
- (NSRect) subtitleFrame;
- (NSImageAlignment) imageAlignment;
There is also a demo project on ADC which can be found at
http://developer.apple.com/library/mac/#/legacy/library/samplecode/ImageKitDemo/Introduction/Intro.html

Resources