Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Brazda |
Scaling down.
Have image(png - size 500x500) for object
’s sprite(size 20x20).
I used scale ration 0.04 on object
’s sprite but that effected how physics are applied to object
later in game. So i don’t want that.
Questions:
1.How to export and save object
’s sprite image while game is running as .png?
2.Why are images that are scaled by other image editors when imported in godot blurry, but when i directly in godot scale them down, they are not?
I have seen that godot does a good job with scaling down (no blurry result) as opposed to paint or many other scaling down applications on internet.
Further reading:
I have been trying for whole day in Java to scale down image, and:
I just can’t understand why i couldn’t convert DataBufferByte
to DataBufferInt
Setup:
f = new File("pic1.png");
image_i = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
image_i = ImageIO.read(f);
int[] pixels = ((DataBufferInt) image_i.getRaster().getDataBuffer()).getData();
Exception:
java.lang.ClassCastException: java.awt.image.DataBufferByte cannot be cast to java.awt.image.DataBufferInt
I have also tried to implement scaling algorithm, as it can be seen here:
http://tech-algorithm.com/articles/nearest-neighbor-image-scaling/
but this exception is stopping me.
For physics mentioned above, I had a bug in code. Physics are good. It was about some calculations for width and height of sprite.
Brazda | 2019-06-19 15:36