I am having an issue where the images are rendered with a strange glowing effect around them, pictured here:
It is tough to see from this close but is extremely noticeable when viewing the app. Also, taking these screenshots into a design program and using the color dropper will prove that there is a glow around these images. Each of these images are PDF files, rendered as a template image so that I can change the tintColor instead of adding more images to my assets folder for each color.
I have read some other articles and questions that says there isn't full support for vector graphics yet (here). However, that is outdated as it specifies iOS 7 as the latest version at the time of writing. Now in iOS 13, I assume there have been changes. Another article I read said to never use vector graphics as they can get messed up when Xcode generates PNGs from the PDFs (here).
Information about the assets in my Images.xcassets:
Render as: Template Image
Resizing: Preserve Vector Data
Scales: Single Scale
I also tried to implement 3 PNGs at different sizes (#1x, #2x, #3x) for each image but got the same effect.
Creating new images with a smaller border size got rid of the glow but obviously, that doesn't fit the design style style that I want in an app. I designed these Icons in Sketch and used a border size of 3, then exported as PDF.
So, as I was writing this question I seemed to have found an answer.
It turns out it had nothing to do with anything in Xcode. The problem lies with Sketch. I redesigned each element in Adobe Illustrator, exported them as PDFs, set the same settings in the assets folder like so:
Render as: Template Image
Resizing: Preserve Vector Data
Scales: Single Scale
Here are the updated screenshots:
I am using:
Sketch (Version 52.5)
Adobe Illustrator (Version 24.2.1)
I don't know why this is an issue, but I hope it can help someone who has this issue down the road. If anyone has any more information on this, please write a comment :).
Related
I'm making an app using Swift in Xcode. I have a few buttons and images on one of my View Controllers. I am using high resolution images, but I noticed that they pixelate to the point where it is visible to the naked eye. There are some questions that I have found pertaining to the resizing of images, but none regarding immediate pixelization. I was hoping someone could help. Below are two images. The first is an image (a screenshot) from my app and the second is an image (also a screenshot) from another app that is not mine. The icon on the other app is smaller, but despite this is less pixelated.
have you tried using svg instead of jpg (lossy) or png(lossless)? It would seem that this would be the way to go, since you can expand to perfect definition on all resizing screens. svg uses code instead of an image format that can be lossy and given the examples you have posted would solve your issue.
you can use paint code for more easy worked , with paint code you can export svg
I figured it out. I just had to increase the dpi
Icons Are Pretty Right?
I'm working on an UI update in an iOS app, and trying to make things look a bit better with some new icons- but I seem to be incapable of determining how to save an image correctly so that it looks good in the interface!
As you can see from this image, if I include a white background with the image it looks great. If I take those same images and use an alpha background they look terrible! It appears that either the images aren't using the #2x correctly, or something else is going horribly wrong.
These images are either saved with GIMP as a png with alpha, or exported from inkscape, the originals are vector graphics. We get the same results from both avenues. I am using both a base imageName.png and imageName#2x.png for scaling.
Somehow, magically, I changed the a single image to greyscale in gimp, and changed the base size to 25px and it showed up with alpha correctly blended. Stock images from apple are also functioning correctly, so it absolutely seems to be something that I'm doing incorrectly when I'm saving the images.
The Setup in XCode
Basic Questions
Is there a certain bit depth, argb vs rgba format, or some other quirk that I need to know to get these images to show up correctly? Is there any way to verify that the program is loading the correct imageName#2x vs imageName? Is there some document that talks about integrated graphics (the iconography documentation isn't very helpful on technical details)
Actual Images
With Background:
Without Background:
I think you will find success if you just save the image at 4x the size you actually want and specify the size manually.
I know this isn't a new problem and I've done a full day (literally) of research. I use the latest Xcode 6, and I'm trying to use all PDF files as vector art resources. However, when I export these images from Illustrator in sRGB (sRGB IEC61966-2.1) , these images show up noticeably darker than if I used a png file.
Some previous suggested solutions are: setting Illustrator file color profile to "web" and choose color space "RGB", and exporting to pdf with Illustrator converting the color space to "sRGB IEC61996-2.1". The latter worked for me for one of the images... And today when I tried the same thing it didn't work!
So I tried all the other solutions, I retried, restarted, tried using different programs, renaming resources, cleaning the project... Nothing worked! The colors still look darker on screen, and the old PDF icon I made look perfect still!
The PDF looks perfect in any other viewer, including Xcode itself, by the way. It's when Xcode compiles, the images get broken (PNG files are generated, and something is wrong with their colorspace).
This is driving me nuts... Anyone else having this problem?
Depending on the screen, you can tell that the center button is quite a bit lighter than the other two icons. I intersected two just to show how distinguishable it is. But on my MacBook Air, they appear identical. Perhaps this has to do with what people say about Apple taking the compiling machine's color space into account? On my iPhone and MacBook they look very different.
Update If I change my MacBook Air's display -> color profile to sRGB, I can clearly tell the difference now. I'm retrying importing the PDF,and maybe the conversion will be correct. Will update.
I've had tremendous troubles with this. And I finally figured it out.
Apple uses sRGB for iOS. To do this you must save your pdf (convert to) in sRGB. I do this with Illustrator -> new -> profile = "web", color space = "RGB" -> save as PDF -> (in options) convert to sRGB. This is suggested by many others in similar questions' solutions. The next... Is what I found out. A trap, if you will.
CAUTION! When you copy past paths over to the new artboard in RGB, the RGB values may have been changed by Illustrator. This took me ages to figure out... Even though the saving to PDF part was right, Illustrator broke it by changing the values by default, making everything darker and more dull.
Hope this helps!
I'm newbie to Affinity Designer and I'm trying to export some Affinity Designer's project to xCode as vectorial pictures in PDF format.
Initially everything was working fine but, after some attempts (I'm designing the launch screen so, after every export, I make some little adjustments then I re-export the PDF) xCode started giving troubles: sometimes picture doesn't appear in XIB, sometimes appear only some giant pixels and, in very luck times picture appears but very grainy.
I tried changing the pixel's size of the picture (is the only setting I see) but it doesn't change nothing so my questions are:
- what are the requirements for xCode's vectorial PDF (resolution or other settings)?
- is there a precise iter to follow in Affinity Designer to export vectorial and import them in xCode? (I can't find any tutorial about it)
Thank you!
EDIT This issue has been fixed some time ago.
I think there's something missing (or wrong... for this context at least) in Affinity Designer's exported PDF files. If you open them in Preview, rotate (and back), then re-save, the vectors will load properly in your app.
I am new to iOS programming and programming in general so this will probably be a fairly easy question to answer for someone who is experienced.
I am making a game using sprite kit and I need to include different background image sizes for the different retina display sizes on the iPhone 4 and 5. I am using a graphics package to create the images in .png format then adding them into the project, the issue I have is that, if I make a 640x1136 size image, it works on the 5, and if I use a 640x960, it works fine on the 4 but leaves blank space around the edge on the 5. (I am running it on the simulator)
If I include two identical images with different names, one for each device, how can I load the right one in? Do I only need high resolution image and can use some code to change how it loads the image in, so that it covers the whole screen without pixelation or loss of quality on both devices?
Any help or advice is appreciated. I apologise if this is a simple question, thanks for your time.
Note:
I found out plenty on the internet about using the #2x suffix for high resolution images, but that's not what I'm looking for. I know how to code for different resolutions, just not two different screen sizes with the same resolution, if that makes any sense.
If you're on iOS 7 SDK which you most likely are, make use of the .xcassets catalogue. It has options for different screen sizes, put the different versions of your image there. And then load image in code.