- Home /
Create, export, and then load a huge image.
Hello,
I want to export a PNG image that is very large, more than 8192x8192.
What I did before reaching images of 8192x8192 was to create a texture2D and after use EncodeToPNG method. But as I started to create larger images, Unity gives me an error because when it create a Texture2D only supports width and height as an integer.
How I can create and export PNG images of any size I want? And then, how I can take that very large image and display it in Unity without losing resolution?
Thanks.
Answer by Gf15a4 · Apr 13, 2015 at 07:59 PM
Well, I have done many things similar to what you are talking about. As for unity talking about intigers only, make sure that it isnt a float. You can make sure by typing (int) before a float to ensure its an int. There shouldnt be a size restriction but if there is, you can use your own save method using bufferblockcopy for RGB to save and bufferblockcopy to load. Bufferblockcopy makes data to binary and binary to data using the same method. This is what i use for my advanced terrain system. As for losing resolution, both methods wont lose any. Png is lossless and so is the custom method as stated above. If you have anymore questions feel free to ask.
Hi, thank you very much. The truth is that I have not understood your post.
Could you explain it again, perhaps more detailed or with an example?
Answer by PatataFrita · Apr 16, 2015 at 09:27 PM
Please, does anyone else can help me to how export very large images?