[Love2d Android] Wrong scaling of images

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Posts: 2
Joined: Sun Sep 22, 2019 5:26 am

[Love2d Android] Wrong scaling of images

Post by bhgt » Sun Sep 22, 2019 6:01 am

I've been working with Love2d Android for some time now, and I've noticed that using a canvas for pixelated effect doesn't work according to the scale.
The attachment Screenshot_2019-09-22-10-42-17-767_org.love2d.android.png is no longer available
As shown in the attachement, the original character is of 16px height (for the character) but on rotating, each (image) pixel seems to be made of 4 (screen/canvas) pixels. I'm not sure if this is a problem with canvas, images, or Android, because even without a canvas, the low resolution images are displayed at higher scale than the actual resolution.
Screenshot_2019-09-22-10-42-17-767_org.love2d.android.png (6.97 KiB) Viewed 984 times
I tried checking the DPIScale of the image and it's 1.

I tried scaling the images to a scale of 0.5 and the pixels seem to be displayed correctly, somehow.

Is this scaling normal, or am I missing something?
Love2d+Android+Pixel Art = bhgt

User avatar
Party member
Posts: 2176
Joined: Sun Oct 18, 2015 2:58 pm

Re: [Love2d Android] Wrong scaling of images

Post by pgimeno » Sun Sep 22, 2019 11:34 am

What version of LÖVE are you using?

Can you give more precise instructions to reproduce the problem? Preferably a short program demonstrating it.

User avatar
Party member
Posts: 2914
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary

Re: [Love2d Android] Wrong scaling of images

Post by zorg » Sun Sep 22, 2019 4:29 pm

It's just a hunch, but usually with this kind of issue, the culprit is usually the fact that while a canvas might indeed be low-resolution, but when the canvas itself gets rotated when it's drawn to the backbuffer (which i'm assuming is indeed of a higher resolution), the blockiness of the contents may not be preserved in some cases.

From the image, i'm guessing you're scaling the canvas first and then rotating (or maybe you're using such parameters with love.graphics.draw), for what i'm guessing you're after, you'd need to rotate first, then scale, to preserve blockiness, i think.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
Posts: 47
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia

Re: [Love2d Android] Wrong scaling of images

Post by AuahDark » Tue Sep 24, 2019 1:37 am

LOVE Android operates on DPI-scale.
* When making new Canvas, Canvas expects the size to be DPI-scaled unless you pass {dpiscale=1} to the 3rd argument.
* When drawing image, the image is drawn in DPI-scaled units and not in pixels.
Profile. I don't always online in forum, so Discord is preferred. Am I LÖVE for Android dev or not? Only you can tell.

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests