object.pixelWidth

Type Number
Revision Release 2024.3703
Keywords steam, steamworks, image, texture, avatar, ImageInfo, pixelWidth
See also ImageInfo
steamworks.*

Overview

An integer indicating the width of the image in pixels.

You can convert this property's pixel width to Corona content-scaled coordinates, relative to the content width and height set in the config.lua file, by multiplying this property by the display.contentScaleX property.

Example

local steamworks = require( "plugin.steamworks" )

-- Fetch information about the logged in user's medium avatar image
local imageInfo = steamworks.getUserImageInfo( "avatarMedium" )

if ( imageInfo ) then
    -- Print the avatar size in pixels
    local message1 = string.format(
        "Medium Avatar Pixel Size: %dx%d",
        imageInfo.pixelWidth,
        imageInfo.pixelHeight )
    print( message1 )

    -- Print the avatar size in Corona's content scaled coordinates
    local message2 = string.format(
        "Medium Avatar Content Size: %dx%d",
        imageInfo.pixelWidth * display.contentScaleX,
        imageInfo.pixelHeight * display.contentScaleY )
    print( message2 )
end