Jump to content
You must now use your email address to sign in [click for more info] ×

Exporting retina assets not resulting in even-numbered pixel dimensions


Recommended Posts

I am creating layer-based export slices (in the Export persona, selecting a layer then clicking "Create Slice" at the bottom of the layers palette). When I export retina assets, they often do not have even-numbered pixel dimensions.

 

This is not useful for app or game development, as the @2x graphics need to be exactly double the size of the non-retina graphics. 

 

Is there anyway to force it to export even-numbered pixel dimensions for @2x?

 

Thanks!

-Mike

Link to comment
Share on other sites

  • Staff

Hi Mike,

 

Welcome to the Forums :)

 

The Export Persona Persona will export depending on the size of the slice. If you have your size not aligned to a whole pixel it will make the exported picture odd. I have tried this at my end and it is working fine. Please could you attach one of your files for me to try and recreate this issue with? Once I have looked at the file I will delete it :)

 

C

Please tag me using @ in your reply so I can be sure to respond ASAP.

Link to comment
Share on other sites

I guess my thought is that slices should *always* be aligned to a whole pixel (or rather, a whole *point*) so that exported sizes are always accurate.

 

When I select a Layer in the Export Persona and click the "Create Slice" button, it appears to snap to whole points, given the dimensions shown for the slice (see attachment). If those dimensions are capable of decimal points, it should definitely show decimal points. I'm having a hard time imagining anyone wanting that behaviour though.

 

Is there an easy way to adjust a slice's size numerically? The only way I can see is to zoom way in and scale each side it to a point edge. This is tedious enough that I would probably rather use other software... :(

 

And thanks, by the way! This is my first real project with AD, and I'm loving it a lot. Reliably getting assets out of it is pretty critical though! :)

Link to comment
Share on other sites

Ah, I see what the problem is now. I have my document set up using the Page Preset of "iPad Air (Retina)". I was assuming (hoping) that the pixel snapping for creating slices would snap to points, not to pixels. Is there any way to make it do that?

 

I have a slice that is showing as 43 x 39, but when I export it at 1x, it exports to 21 x 19, and the @2x file is 43 x 39. This doesn't work for me (or any game dev), unfortunately. The files need to be precise multiples of each other to work properly.

Link to comment
Share on other sites

Sorry for the multiple posts. Changing the DPI of the document seems to mess with the Export Persona's measurements, actually. I'm attaching the file with just the one asset in it. This layer was created BEFORE changing the DPI.

 

If you switch to the Export Persona you can see that the "Tower1Projectile" slice actually shows up empty. It also exports an empty PNG. The bounding box for it does not show in the document view, and the dimensions of it (in the "Transform" palette) still show as the dimensions it was BEFORE switching the DPI.

 

I created a new layer, added a 5x5 rectangle to it and created a new slice from that, and that works the way I expect.

Link to comment
Share on other sites

  • Staff

Hi weheartgames,

No problem. Feel free to post at will  ^_^

Currently slices don't update if you change the size of the document. There's still some work to do here.

There's also other improvements planned for the Export persona later (including previews). We just need some time to get there  ;)

Link to comment
Share on other sites

  • Staff

Slices are always aligned to whole document pixels.  A 2x and 3x should give you documents that are 2 and 3 times the original whole pixel size.

 

When exporting a linked slice, the bounding box for that layer being exported is widened to whole pixels.

 

We do have a bit of code that corrects documents that were created with retina DPI (144, for example).  This might have some affect like you are describing. They are assumed to already be in retina format, and that might be an odd pixel count.  The 1x version will then be 50% of the original size instead (which will be halved then rounded - so a 13 pixel document would come out at 6 pixel, for example).  Use 72dpi, then your document is assumed to be in standard mode, and 2x and 3x export will work as expected.

 

If you have an example, I can look into it.

SerifLabs team - Affinity Developer
  • Software engineer  -  Photographer  -  Guitarist  -  Philosopher
  • iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395
  • MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300
  • iPad Pro 10.5", 256GB
Link to comment
Share on other sites

  • Staff

Is there an easy way to adjust a slice's size numerically? The only way I can see is to zoom way in and scale each side it to a point edge. This is tedious enough that I would probably rather use other software... :(

 

You can adjust the position and size of a slice using the Transform panel.

SerifLabs team - Affinity Developer
  • Software engineer  -  Photographer  -  Guitarist  -  Philosopher
  • iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395
  • MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300
  • iPad Pro 10.5", 256GB
Link to comment
Share on other sites

Whoops, I thought I had attached that document a couple posts ago. 

 

Slices snapping to whole pixels: that's great! But my issue is that I want them to snap to whole points, rather than pixels. My document was set to 1024x768 points, with a dpi of 144 (so that I still had the resolution to export @2x without issue, or that was my intention, in case I used any pixel layers).

 

So I was getting slices that were snapping to odd-numbered pixel dimensions, which exported @2x graphics at that size. Which means the "@1x" graphics could not be exactly half the size of the @2x graphics.

 

In any case, the attachment here demonstrates a problem I found when trying to change my document resolution to 72, to try to force the slices to be calculated with whole pixels at the "@1x" level, rather than at the @2x level. When I did that, I had problems creating layer slices from layers that had already existed in the document, *before* the resolution change. There was no problem making layer-based slices from newly-created layers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.