Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sketch to XCode Image Size? (baffler)

I'm working with Sketch by Bohemian Coding. It has preset iPhone artboards that include 640x960 and 640x1136, but when I export the images to XCode the size and positions of the images are incorrect. Do I have to resize my images? Is there any way I can create the images in the correct size every time?

Even though the Sketch image is designed for 640x960, in another project I made the images to 640x1136 and it did the same thing.


Screenshots enter image description here

enter image description here

like image 683
Biff Avatar asked Nov 17 '25 20:11

Biff


1 Answers

Assuming the rectangle surrounding 'AC' is the image you're trying to export, it almost looks like the XCode image is twice the size of the original. In which case, are you naming the file with a '@2x.png' suffix?

edit:

So I played around with Sketch, using the 640px by 1136px preset. Then I checked the Also export as: option with both Double size (@2x) and Half size (@1x) separately. From the basic info Finder reports - What I noticed was this:

Generated files suffix ==> "@2x.png"        ".png" (without suffix)
===================
Actual file pixels
"Double size"              1280 x 2272      640 x 1136
"Half size"                640  x 1136      320 x 568

Maybe the chart is a little confusing, but from what I can tell, the Double size and Half size options don't seem to mean anything since the art boards are always generated in retina resolutions anyways. To get the right naming convention for the right resolution, you'll want to use the Half size option, and import the @2x file for retina devices, and the regular png for non-retina devices.

TL:DR - Use "Also export as: Half size"

like image 148
Mic Fok Avatar answered Nov 19 '25 10:11

Mic Fok