Large images problem on iPad

Next thing to confirm is that TP is including the “sheetContentWidth” and “sheetContentHeight” properties in its image sheet setup. These are required for dynamic image selection from image sheets, as explained here:

http://docs.coronalabs.com/api/library/graphics/newImageSheet.html

Thank you brent. I’ve checked already, the lua files have both properties. Just to be sure that the problem is clear. Corona is loading the correct image, i’ve write a text over the image 4x and 2x to be sure, however, the 4x image is loaded streched, if I load the very same image but out of the spritesheet file and directly from newImageRect it is loaded fine. I’ve opened the spritesheet on my desktop and it is high resolution, so apparently TP is generating a correct image.

In this case, my guess is that the width and height parameters that you’re pulling in (for the last two arguments of the newImageRect() call) are not the correct “1x” size. Do a print() and confirm that you’re getting the correct values… again, these should be the size of the default “1x” image.

Brent

The values are correct, I’ve tested with the background (380, 570) and another image file, the values are the same that I’ve used to test with individual images rather than spritesheets images.

Hi @mambo,

I still don’t know what the issue is. Are you saying it only happens if you set these up as sprites (display.newSprite), but if you use the exact same image sheet and place a static image (display.newImageRect) from one frame, it’s correct?

Thanks Brent. Actually no. The image only looks fine if I don’t use a sprite sheet file at all. For example, suppose I have 3 files (“background.png”, “logo.png”, “button.png”), then I use TP to generate a sprite sheet (“startScreenSheet.png”) containing these 3 images, ok? If I use like the code below, for example, it works perfectly:

local img = display.newImageRect("background.png", 380 , 570 )

However, if I use like the code below: 

local startSheetInfo = require('startScreenSheet') local startSheet = graphics.newImageSheet("startScreenSheet.png", startSheetInfo:getSheet() ) local frame = startSheetInfo:getFrameIndex("background") local img = display.newImageRect( startSheet, frame, startSheetInfo:getSheet().frames[frame].wi dth, startSheetInfo:getSheet().frames[frame].height )

the image loses quality, the edges are blurry, looks like a slightly streched image. Obviously, the first reason that come to mind is that TP somehow decreases the image quality, but if I open the sprite sheet file on my desktop, the image looks perfect.

Is it more clear now?

Hi @mambo,

Can you give me the exact pixel dimensions of these 3 images, then show me the contents of the Lua file that TP generates which contains the parameters for each frame?

Hi, after a long winter, I finally found a very simple solution to my problem. When I generate my images from TP I set the “PNG Opt Level” to max, which is 7, now the images are perfect.

Thanks for your support.

mambostudio:

I want to thank you for taking the time to post the ANSWER to your problem.  It’s far too often that a poster will fail to due that having solved the problem for themselves.

Well done!

Sorry about the delay to answer, I’ve asked some tests to the design team to try to understand what exactly is happening. Apparently TP is actually reducing the image quality. When I generate a half sized image directly from Photoshop it looks fine on the device, but when TP generate the half size image it somehow loses quality. We’ll keep trying to isolate the problem to identify what exactly is causing the issue.

In TP you can change the output of the png file this combined with image-padding/border/inner-padding etc. is more than likely your problem. 

Hi, after a long winter, I finally found a very simple solution to my problem. When I generate my images from TP I set the “PNG Opt Level” to max, which is 7, now the images are perfect.

Thanks for your support.

mambostudio:

I want to thank you for taking the time to post the ANSWER to your problem.  It’s far too often that a poster will fail to due that having solved the problem for themselves.

Well done!