Author Topic: How do I prevent image scaling?  (Read 2063 times)

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
How do I prevent image scaling?
« on: September 22, 2016, 06:19:06 pm »
Hello,

How do I prevent image scaling? I noticed this when doing a screenshot of the map area. As I can remember it was 640x480, but the map size was really half that size 320x240. I reduced the image size to 320x240, but the image scales up to match the original 640x480 and this affects the quality of the image.

I attached images below. It shows that the map is set to 320x240, but it really is 640x480.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1173
    • View Profile
Re: How do I prevent image scaling?
« Reply #1 on: September 22, 2016, 06:26:38 pm »
Just change the zoom setting.

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: How do I prevent image scaling?
« Reply #2 on: September 22, 2016, 08:24:15 pm »
Ah, so the zoom setting made it 640x480 in the editor. That part makes sense now, but everything still scales when the game is played and that affects the image quality. Is there a way to change the zoom settings just for the that is image?


For instance, the game scales to 640x480 when playtest occurs. My volume background menu was originally 640x480 to match the scale change, but my image (volume background image) scales to 960x700 on playtest. Is there a way to prevent the scaling of my image only for sol.surface.create("Volume_background.png")?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1173
    • View Profile
Re: How do I prevent image scaling?
« Reply #3 on: September 22, 2016, 08:33:55 pm »
The base size of your quest screen can be set in your quest properties (File > Quest Properties > Quest size).

When running the game then, the rendering is scaled to fit the size of the window, but you have nothing special to do. You only work in quest size coordinates. There is no scaling when you create a surface from Lua. The scaling is only done to fit the window in the end.

It is possible to set the size of the window from Lua, I don't know if this is what you want.

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: How do I prevent image scaling?
« Reply #4 on: September 22, 2016, 10:10:37 pm »
I figured it out.

I changed the window size: sol.video.set_window_size(640, 480)

After that I changed the minimum and maximum quest size to 640, 480.

The image turned out perfect, but a bit big. I guess either way having my image at 320x240 is best for the window size.



Without those settings the 640x480 image ends up like this.


Works fine when resized 320x240. (Lower quality)